Skip to content
A small factory implementation for js-signals.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc
test
.gitignore
.travis.yml
LICENSE
README.md
SignalFactory.js
SignalFactory.min.js
bower.json
package.json

README.md

js-signals-factory

Build Status No Maintenance Intended

A small factory implementation for js-signals.

Requirements

This is a simple wrapper to make it even easier to use js-signals.

As expected, you will need to have signals available in your application before using this script.

Usage

The signals factory reduces your signal management to a single point where you can request and retrieve all your signals. Using a signal is as simple as:

Get a simple signal

    var completed = SignalFactory.getSignal();
    completed.add(function () {
        console.log('it is completed!');
    });

Get named signals

    // First register a callback function to your signal
    SignalFactory.getSignal('completed').add(function () {
        console.log('it is completed!');
    });

    SignalFactory.getSignal('completed').dispatch();
    // it is completed!

    // Remove reference by name
    SignalFactory.removeSignal('completed');

Get an array with all signals

    var all = SignalFactory.all();

Remove all used signals

    SignalFactory.clear();
    // All used signals are disposed and gone!

License

Released under the MIT License.

You can’t perform that action at this time.