Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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封装,提供事件的添加、移除等操作。

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