Skip to content

Instantly share code, notes, and snippets.

@ashwinkumar2438
Last active November 15, 2020 14:24
Show Gist options
  • Save ashwinkumar2438/6847bb2e44f61d856dcecb6bfb176d33 to your computer and use it in GitHub Desktop.
Save ashwinkumar2438/6847bb2e44f61d856dcecb6bfb176d33 to your computer and use it in GitHub Desktop.
{
off(eventname,callback){
if(!this.hasOwnProperty(eventname))return false;
if(!(callback && callback.constructor===Function))return false;
if(Array.isArray(this[eventname])){
this[eventname]=this[eventname].filter(eventcb=>eventcb!==callback);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment