one
Register an event handler that gets called only once.
obj.one(event, handler(event, args...) )
Adds a basic event listener that listens to an event once and only once.
obj.one("prop", function(){
console.log("prop dispatched");
})
obj[canSymbol.for("prop")]("prop") //-> logs "prop dispatched"
obj[canSymbol.for("prop")]("prop")
Parameters
- eventName
{String}
:The name of the event to listen to.
- handler
{function(event, args...)}
:The handler that will be run when the event is dispached.
Returns
{Object}
:
this