Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/whitered/Signaller

ActionScript signals implementation with restricted rights for dispatching
https://github.com/whitered/Signaller

Last synced: about 2 months ago
JSON representation

ActionScript signals implementation with restricted rights for dispatching

Awesome Lists containing this project

README

        

Signaller ActionScript library.

Signal represents an event and allows to listen for it.

Signaller is a wrapper on Singal class. It gives the ability to dispatch events.

Both this classes are implement ISignal interface.

Typical usage:

class Ticker
{
private const _onTick:Signaller = new Signaller();

public const onTick:Signal = _onTick.signal;

private function doSomething():void
{
...
_onTick.dispatch("tick!");
}
}

class TickerManager
{
public function workWithTicker(ticker:Ticker):void
{
ticker.onTick.add(handleTick);

// It's impossible to dispatch onTick signal from outside of the ticker
// ticker.onTick.dispatch() - will fail
}

private function handleTick(tickerMessage:String):void
{
ticker.onTick.remove(handleTick);
}
}