You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @kasper, first and foremost, this is awesome tool! Thanks for your work.
Description
This is a small feature request for convenience, it would be nice to be able to subscribe to an event only once so when it's called, the event is automatically unsubscribed.
Most of event managers out there provide this feature and I think it could be cool.
As a bonus, if the handler explicitly returns false the event is not unsubscribed. So it lets the user filter the event he wants to be executed one.
Example
constfilteredCallback=(appName,callback)=>(app)=>app.name()===appName
? callback(app)
: _.stubFalse()Event.on('appDidLaunch',filteredCallback('Code',()=>{Event.once('appDidActivate',filteredCallback('Code',()=>{// do stuff only once})})
The text was updated successfully, but these errors were encountered:
Hi @ngryman! Thanks for the kind words! This definitely seems like a good addition to the API and is easy to implement in the JavaScript library. I will look into it!
Hi @kasper, first and foremost, this is awesome tool! Thanks for your work.
Description
This is a small feature request for convenience, it would be nice to be able to subscribe to an event only once so when it's called, the event is automatically unsubscribed.
Most of event managers out there provide this feature and I think it could be cool.
As a bonus, if the handler explicitly returns
false
the event is not unsubscribed. So it lets the user filter the event he wants to be executed one.Example
The text was updated successfully, but these errors were encountered: