js pub sub with post bindings & stack tracing
JavaScript
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
tests
.gitignore
LICENSE.txt
README.md
bower.json
fatcontroller.js

README.md

fatcontroller

js pub sub, with post bindings & stack tracing

Install

bower install --save fatcontroller

Dependencies

  • Lodash/Underscore

Basic Usage

fc.on('some:event', function() {
  // ...
});

fc.trigger('some:event');

Documentation by example

// Single use bindings are available

fc.once('some:event', someFunction);



// Post bindings can be bound and triggered after an event occurred.
// This is useful when asynchronous modules depend on state changes.

// Something denotes a state change
fc.trigger('some:event');

// The binding will immediately be called as the event has occurred
fc.after('some:event', someFunction);

// Post bindings can also defer the callback until multiple events have
// all occurred
fc.afterAll(['some:event', 'another:event', 'yet:another:event'], someFunction);


// Debug tracing will trace and log all the actions that are
// being sent through fatcontroller

fc.debug = true;

// Logs a stack trace indicating where the binding originated from
fc.on('some:event', someFunction);

// Logs a stack trace indicating where the event was triggered
fc.trigger('some:event');



// Bindings can be removed by event name and callback
fc.off('some:event');
fc.off('some:event', someFunction);