on() method from fcf.EventEmitter class
Package: fcf-framework-core
File: fcf-framework-core:fcf.js
Available from version: 2.0.2
Adds an event handler
Arguments
- Event name
- Event handler function. The function has the following signature: (async or simple) a_cb(mixed a_data)
-
mixed a_data - Data passed when the event was fired
Example: Function application
class Test extends fcf.EventEmitter {
};
let testObject = new Test();
testObject .on ("call", (a_event)=>{
console.log(a_event)
});
testObject .emit ("call", {info: "value"});
Output:
{ info: 'value' }