Custom Event/Messaging system for JavaScript inspired by AS3-Signals
JavaScript Other
Pull request Compare This branch is 6 commits ahead, 18 commits behind millermedeiros:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Strict Type Checking

(enhancement by

When you create a new Signal, you can do it the normal way:

mySignal = new Signal(); // no argument verification rules will be applied.

or with typed arguments a la Robert Penner's original AS3 implementation:

mySignal = new Signal( Number, String, Array, Date, Function, MyClass );

or with a single argument containing a hash of named keys:

mySignal = new Signal( {x:Number, y:String, z:Array, a:Date, b:Function, c:MyClass} );

when you dispatch, arguments are verified against whatever passed to the constructor. Currently the only behavior is to throw an error if verification fails.

The idea is to find mis-matches more quickly during development -- you should be able to swap it for the original version during deployment (no checks == better performance).

I haven't done anything yet with allowing nulls in certain cases, i.e. optional arguments. We'll see if it actually comes up in practice.


Custom event/messaging system for JavaScript inspired by AS3-Signals.

For a more in-depth introduction read the JS-Signals Project Page and visit the links below.



Distribution Files

You can use the same distribution file for all the evironments, browser script tag, AMD, CommonJS (since v0.7.0).

Files inside dist folder:

  • docs/index.html : Documentation.
  • signals.js : Uncompressed source code with comments.
  • signals.min.js : Compressed code.

You can install JS-Signals on Node.js using NPM

npm install signals


Note that there is an advanced Signal type called CompoundSignal that is compatible with js-signals v0.7.0+. It's useful for cases where you may need to execute an action after multiple Signals are dispatched. It was split into its' own repository since this feature isn't always needed and that way it can be easily distributed trough npm.

CompoundSignal repository

Repository Structure

Folder Structure

dev       ->  development files
|- build       ->  files used on the build process
|- src         ->  source files
|- tests       ->  unit tests
dist      ->  distribution files
|- docs        ->  documentation


master      ->  always contain code from the latest stable version
release-**  ->  code canditate for the next stable version (alpha/beta)
develop     ->  main development branch (nightly)
**other**   ->  features/hotfixes/experimental, probably non-stable code

Building your own

This project uses Apache Ant for the build process. If for some reason you need to build a custom version of JS-Signals install Ant and run:

ant build

This will delete all JS files inside the dist folder, merge/update/compress source files, validate generated code using JSLint and copy the output to the dist folder.

There is also another ant task that runs the build task and generate documentation (used before each deploy):

ant deploy

IMPORTANT: dist folder always contain the latest version, regular users should not need to run build task.