EventEmitter for Titanium
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
EventEmitter.js
README
package.json

README

EventEmitter for Titanium

Usage:

In Resources folder

npm install ti-event-emitter

In your source code

require('/node_modules/ti-event-emitter/EventEmitter')

// Initialise the EventEmitter
var ee = new EventEmitter();

// Initialise the listener function
function myListener() {
   alert('The foo event was emitted.');
}

// Add the listener
ee.addListener('foo', myListener);

// Emit the foo event
ee.emit('foo'); // The listener function is now called

// Remove the listener
ee.removeListener('foo', myListener);

// Log the array of listeners to show that it has been removed
alert(ee.listeners('foo'));