Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/caojianping/tsx-event
JavaScript Events的TypeScript封装,提供事件的添加、移除等操作。
https://github.com/caojianping/tsx-event
events javascript jts-events typescript
Last synced: 9 days ago
JSON representation
JavaScript Events的TypeScript封装,提供事件的添加、移除等操作。
- Host: GitHub
- URL: https://github.com/caojianping/tsx-event
- Owner: caojianping
- License: mit
- Created: 2020-02-15T11:07:13.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-30T06:41:41.000Z (over 1 year ago)
- Last Synced: 2024-10-12T05:28:08.080Z (about 1 month ago)
- Topics: events, javascript, jts-events, typescript
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tsx-event
事件处理封装库,提供通用的API方法。## Installing
Using npm:
```bash
$ npm install tsx-event
```## Example
```ts
import Events from 'tsx-event';function testHandler(event: any){
console.log('bala bala bala!');
}Events.addEvent(document, 'click', testHandler);
Events.removeEvent(document, 'click', testHandler);
```## API
##### Events.addEvent(element: any, type: string, handler: Function, userCapture: boolean = false): void
##### Events.removeEvent(element: any, type: string, handler: Function, userCapture: boolean = false): void