Skip to content

Latest commit

 

History

History
24 lines (19 loc) · 576 Bytes

README.md

File metadata and controls

24 lines (19 loc) · 576 Bytes

tsx-event

事件处理封装库,提供通用的API方法。

Installing

Using npm:

$ npm install tsx-event

Example

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