Skip to content

Latest commit

 

History

History
executable file
·
48 lines (36 loc) · 1.12 KB

README.md

File metadata and controls

executable file
·
48 lines (36 loc) · 1.12 KB

Event switch

easily manage javascript event handling

About

Easily manipulate event registration and deletion. It also supports events registered with anonymous functions.

Usage

Installing

<script src="/path/to/plugin/eventSwitch.min.js">

Regist event

var clickEvent = esw('.trigger','click',function(e){ console.log(e) });

Option

var clickEvent = esw(trigger,event,listener,option);
Option Type Description
trigger string / object css selector or DOM object(document, window...etc)
event string event name
listener function(event) function. can use anonymous function
option anything eventlistner standard setting(option or useCapture) If you want to make different settings for addEventlistener and removeEventlistener. It's possible by using arrays.(ex. [addEventlistener_option, removeEventlistener_option])

API

var clickEvent = esw(trigger,event,listener,option);

//remove event
clickEvent.switch('off')

//restore event & event attach
clickEvent.switch('on')

//check event state(boolean) 
clickEvent.isActive

License

MIT