Namespace: signals

system. signals

The system.signals library is light-weight, strongly-typed messaging tools. Wire your application with better APIs and less boilerplate than W3C DOMEvents..

Concept:

  • A Signal is essentially a minimal emiter specific to one event, with its own array of receivers/slots (Receiver or Function).
  • A Signal gives an event a concrete membership in a class.
  • Receivers subscribe to real objects, not to string-based channels.
  • Event string constants are no longer needed.
  • Signals are inspired by signals/slots in Qt.
    Author:
    License:

    Example

    function Slot( name )
    {
        this.name = name ;
    }
    
    Slot.prototype = Object.create( system.signals.Receiver.prototype );
    Slot.prototype.constructor = Slot;
    
    Slot.prototype.receive = function ( message )
    {
        trace( this + " : " + message ) ;
    }
    
    Slot.prototype.toString = function ()
    {
        return "[Slot name:" + this.name + "]" ;
    }
    
    var slot1 = new Slot("slot1") ;
    
    var slot2 = function( message )
    {
        trace( this + " : " + message ) ;
    }
    
    var signal = new system.signals.Signal() ;
    
    //signal.proxy = slot1 ;
    
    signal.connect( slot1 , 0 ) ;
    signal.connect( slot2 , 2 ) ;
    
    signal.emit( "hello world" ) ;

    Classes

    Signal
    SignalEntry