3.0.11 • Published 9 months ago

ste-signals v3.0.11

Weekly downloads
2,619
License
MIT
Repository
github
Last release
9 months ago

Strongly Typed Events - Signals

Signals are the most barebone of all events. They don't contain any data. They just invoke the registered handler.

Build Status npm version License: MIT

Subscription made easy

An example says more than a 1000 words. Imagine if you have events like this on your class:

let clock = new Clock("Smu", 1000);

//log the ticks to the console - this is a signal event
clock.onTick.subscribe(() => console.log("Tick!"));

Events made easy

So let's look at the implementation from a TypeScript perspective. (Do you program NodeJs without typescript? Check this)

import { SignalDispatcher } from "ste-signals";

class Clock {
  private _onTick = new SignalDispatcher();
  private _ticks: number = 0;

  constructor(public name: string, timeout: number) {
    setInterval(() => {
      this._ticks += 1;
      this._onTick.dispatch();
    }, timeout);
  }

  public get onTick() {
    return this._onTick.asEvent();
  }
}

Check the documentation or the examples for more information.

Need more info? Check the repo.

Maintenance

This project is maintained by Kees C. Bakker.

3.0.11

9 months ago

3.0.9

1 year ago

3.0.8

1 year ago

3.0.7

1 year ago

3.0.6

2 years ago

3.0.4

2 years ago

3.0.5

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

2.1.16

2 years ago

2.1.14

2 years ago

2.1.13

3 years ago

2.1.12

3 years ago

2.1.11

3 years ago

2.1.10

3 years ago

2.1.9

3 years ago

2.1.8

3 years ago

2.1.7

3 years ago

2.1.6

3 years ago

2.1.4

3 years ago

2.1.3

3 years ago

2.1.5

3 years ago

2.1.2

3 years ago

2.0.9

3 years ago

2.0.6

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.5

3 years ago

1.7.3

3 years ago

1.7.2

3 years ago

1.7.1

3 years ago

1.6.22

4 years ago

1.6.21

4 years ago

1.6.20

4 years ago

1.6.19

4 years ago

1.6.17

4 years ago

1.6.16

4 years ago

1.6.15

4 years ago

1.6.14

4 years ago

1.6.13

4 years ago

1.6.12

4 years ago

1.6.9

4 years ago

1.6.11

4 years ago

1.6.10

4 years ago

1.6.8

4 years ago

1.6.7

4 years ago

1.6.6

4 years ago

1.6.5

4 years ago

1.6.4

4 years ago

1.6.3

5 years ago

1.6.2

5 years ago

1.6.1

5 years ago

1.5.3

5 years ago

1.5.2

5 years ago

1.4.11

5 years ago

1.4.10

5 years ago

1.4.8

5 years ago

1.4.6

6 years ago

1.4.5

6 years ago

1.4.3

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.3.13

6 years ago

1.3.12

6 years ago

1.3.11

6 years ago

1.3.10

6 years ago

1.3.9

6 years ago

1.3.8

6 years ago

1.3.7

6 years ago

1.3.6

6 years ago

1.3.5

6 years ago

1.3.4

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago