jockeyjs icon indicating copy to clipboard operation
jockeyjs copied to clipboard

optional `off` argument to off a specific handler

Open jcppman opened this issue 9 years ago • 0 comments

Hi, thanks for this great bridge!

In some scenario, on js side an additional optional second argument of off to only unsubscribe specific handler could be really helpful.

function firstHandler(){
  console.log('I am on fire');
}
function secondHandler(){
  console.log('me too');
}

Jockey.on('myEvent', firstHandler);
Jockey.on('myEvent', secondHandler);
Jockey.off('myEvent', secondHandler);

// when event 'myEvent' comes:
// output is only 'I am on fire'

I'd happy to provide a PR if other ppl also like to have this feature

jcppman avatar Jan 26 '16 06:01 jcppman