{"id":19640123,"url":"https://github.com/chimeejs/chimee-helper-events","last_synced_at":"2026-06-10T18:31:25.878Z","repository":{"id":57197960,"uuid":"96407996","full_name":"Chimeejs/chimee-helper-events","owner":"Chimeejs","description":"base events binder for chimee","archived":false,"fork":false,"pushed_at":"2019-05-31T17:22:30.000Z","size":91,"stargazers_count":0,"open_issues_count":9,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-28T01:45:51.880Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Chimeejs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-06T08:38:42.000Z","updated_at":"2018-11-28T02:08:23.000Z","dependencies_parsed_at":"2022-09-16T13:10:52.043Z","dependency_job_id":null,"html_url":"https://github.com/Chimeejs/chimee-helper-events","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chimeejs%2Fchimee-helper-events","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chimeejs%2Fchimee-helper-events/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chimeejs%2Fchimee-helper-events/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chimeejs%2Fchimee-helper-events/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Chimeejs","download_url":"https://codeload.github.com/Chimeejs/chimee-helper-events/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240947652,"owners_count":19883030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T14:04:43.319Z","updated_at":"2026-06-10T18:31:25.841Z","avatar_url":"https://github.com/Chimeejs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chimee-helper-events\n\n[![Build Status](https://img.shields.io/travis/Chimeejs/chimee-helper-events/master.svg?style=flat-square)](https://travis-ci.org/Chimeejs/chimee-helper-events.svg?branch=master)\n[![Coverage Status](https://img.shields.io/coveralls/Chimeejs/chimee-helper-events/master.svg?style=flat-square)](https://coveralls.io/github/Chimeejs/chimee-helper-events?branch=master)\n[![npm](https://img.shields.io/npm/v/chimee-helper-events.svg?colorB=brightgreen\u0026style=flat-square)](https://www.npmjs.com/package/chimee-helper-events)\n[![dependency Status](https://david-dm.org/Chimeejs/chimee-helper-events.svg)](https://david-dm.org/Chimeejs/chimee-helper-events)\n[![devDependency Status](https://david-dm.org/Chimeejs/chimee-helper-events/dev-status.svg)](https://david-dm.org/Chimeejs/chimee-helper-events?type=dev) [![Greenkeeper badge](https://badges.greenkeeper.io/Chimeejs/chimee-helper-events.svg)](https://greenkeeper.io/)\n\nevents handler of chimee\n\n## get started\n\n```shell\nnpm install chimee-helper-events --save\n```\n\n## doc\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### event\n\n[src/index.js:16-16](https://github.com/Chimeejs/chimee-helper-events/blob/43f39c489f1d638cb6ba1e7e634889f42b2ef810/src/index.js#L16-L16 \"Source code on GitHub\")\n\n自定义事件基础类\n\n**Meta**\n\n-   **author**: huzunjie\n\n### getEvtTypeCache\n\n[src/index.js:25-48](https://github.com/Chimeejs/chimee-helper-events/blob/43f39c489f1d638cb6ba1e7e634889f42b2ef810/src/index.js#L25-L48 \"Source code on GitHub\")\n\n得到某对象的某事件类型对应的监听队列数组\n\n**Parameters**\n\n-   `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 发生事件的对象\n-   `type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 事件类型(这里的时间类型不只是名称，还是缓存标识，可以通过添加后缀来区分)\n\nReturns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** \n\n### emitEventCache\n\n[src/index.js:57-67](https://github.com/Chimeejs/chimee-helper-events/blob/43f39c489f1d638cb6ba1e7e634889f42b2ef810/src/index.js#L57-L67 \"Source code on GitHub\")\n\n触发事件监听方法\n\n**Parameters**\n\n-   `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 发生事件的对象\n-   `type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 事件类型\n-   `eventObj` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 触发事件时要传回的event对象\n\nReturns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)** \n\n### addEventCache\n\n[src/index.js:78-94](https://github.com/Chimeejs/chimee-helper-events/blob/43f39c489f1d638cb6ba1e7e634889f42b2ef810/src/index.js#L78-L94 \"Source code on GitHub\")\n\n添加事件监听到缓存\n\n**Parameters**\n\n-   `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 发生事件的对象\n-   `type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 事件类型\n-   `handler` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** 监听函数\n-   `isOnce` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 是否单次执行 (optional, default `false`)\n-   `handlerWrap` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)** \n\n### removeEventCache\n\n[src/index.js:103-126](https://github.com/Chimeejs/chimee-helper-events/blob/43f39c489f1d638cb6ba1e7e634889f42b2ef810/src/index.js#L103-L126 \"Source code on GitHub\")\n\n移除事件监听\n\n**Parameters**\n\n-   `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 发生事件的对象\n-   `type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 事件类型\n-   `handler` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** 监听函数\n-   `isOnce`   (optional, default `false`)\n\nReturns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)** \n\n### CustEvent\n\n[src/index.js:139-208](https://github.com/Chimeejs/chimee-helper-events/blob/43f39c489f1d638cb6ba1e7e634889f42b2ef810/src/index.js#L139-L208 \"Source code on GitHub\")\n\nEvent 自定义事件类\n1\\. 可以使用不传参得到的实例作为eventBus使用\n2\\. 可以通过指定target，用多个实例操作同一target对象的事件管理\n3\\. 当设定target时，可以通过设置assign为true，来给target实现\"on\\\\once\\\\off\\\\emit\"方法\n\n**Parameters**\n\n-   `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 发生事件的对象（空则默认为event实例）\n-   `assign` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 是否将\"on\\\\once\\\\off\\\\emit\"方法实现到target对象上\n\nReturns **[event](#event)** \n\n#### on\n\n[src/index.js:172-175](https://github.com/Chimeejs/chimee-helper-events/blob/43f39c489f1d638cb6ba1e7e634889f42b2ef810/src/index.js#L172-L175 \"Source code on GitHub\")\n\n添加事件监听\n\n**Parameters**\n\n-   `type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 事件类型\n-   `handler` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** 监听函数\n-   `isOnce` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 单次监听类型 (optional, default `false`)\n\nReturns **[event](#event)** \n\n#### once\n\n[src/index.js:183-185](https://github.com/Chimeejs/chimee-helper-events/blob/43f39c489f1d638cb6ba1e7e634889f42b2ef810/src/index.js#L183-L185 \"Source code on GitHub\")\n\n添加事件监听,并且只执行一次\n\n**Parameters**\n\n-   `type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 事件类型\n-   `handler` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** 监听函数\n\nReturns **[event](#event)** \n\n#### off\n\n[src/index.js:194-197](https://github.com/Chimeejs/chimee-helper-events/blob/43f39c489f1d638cb6ba1e7e634889f42b2ef810/src/index.js#L194-L197 \"Source code on GitHub\")\n\n移除事件监听\n\n**Parameters**\n\n-   `type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 事件类型\n-   `handler` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** 监听函数(不指定handler则清除type对应的所有事件监听)\n-   `isOnce` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 单次监听类型 (optional, default `false`)\n\nReturns **[event](#event)** \n\n#### emit\n\n[src/index.js:204-207](https://github.com/Chimeejs/chimee-helper-events/blob/43f39c489f1d638cb6ba1e7e634889f42b2ef810/src/index.js#L204-L207 \"Source code on GitHub\")\n\n触发事件监听函数\n\n**Parameters**\n\n-   `type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 事件类型\n-   `data`  \n\nReturns **[event](#event)** \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchimeejs%2Fchimee-helper-events","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchimeejs%2Fchimee-helper-events","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchimeejs%2Fchimee-helper-events/lists"}