FCF 2.0 development in progress...
> > > > > >
[News] [Packages API] [Downloads] [Donate to the project] [Contacts]

detach() method from fcf.EventEmitter class

detach(function a_cb)
detach(string a_name, function a_cb)

Package: fcf-framework-core

File: fcf-framework-core:fcf.js

Available from version: 2.0.2

Unbinds an event handler

Arguments

string a_name
- The name of the event. If set, event unbinding will be performed only for the specified event.

function a_cb
- 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' }