bespokejs / bespoke

DIY Presentation Micro-Framework

Home Page:http://markdalgleish.com/projects/bespoke.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add an off method

mojavelinux opened this issue · comments

Add an off method as a complement to the on method. I've come across situations in my plugins when I want to listen for deck events only at certain times. It would be nice if I could unregister an event handler. jQuery has an off method for this very purpose. I think Bespoke.js needs the same.

If I understand the code correctly, it seems that if you invoke the function that is returned from the on method, it unregisters the event.

deck.on('activate', activate)();

However, this is a very bizarre API, IMO. I'd much rather have an explicit off method to call.