detach() method from fcf.EventEmitter class
Package: fcf-framework-core
File: fcf-framework-core:fcf.js
Available from version: 2.0.2
Unbinds an event handler
Arguments
- The name of the event. If set, event unbinding will be performed only for the specified event.
- Detachable event handler
Example: Function application
class Test extends fcf.EventEmitter {
};
let testObject = new Test();
function callback(a_event) {
console.log(a_event)
}
testObject .on ("call", callback);
testObject .emit ("call", {info: "value"});
testObject .detach (callback);
testObject .emit ("call", {info: "value"});
Output:
{ info: 'value' }