Skip to content

Commit c670b92

Browse files
Merge pull request #31 from RobotlegsJS/update-readme
Add instructions about how to install and use the SignalsJS
2 parents 703a590 + 9e5555e commit c670b92

File tree

3 files changed

+51
-7
lines changed

3 files changed

+51
-7
lines changed

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
/test
1111
/transpiled-code
1212
/typings
13-
CHANGELOG.md
1413
CODE_OF_CONDUCT.md
1514
CONTRIBUTING.md
1615
ISSUE_TEMPLATE.md

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
## Signals 0.0.1
2020

21-
### v0.0.12
21+
### [v0.0.12](https://github.com/RobotlegsJS/SignalsJS/releases/tag/0.0.12) - 2017-11-14
2222

2323
- Add Changelog (see #25).
2424

@@ -28,6 +28,8 @@
2828

2929
- Add Pull Request Template (see #28).
3030

31+
- Update README (see #31).
32+
3133
- Solve compilers deprecation warning messages from mocha.
3234

3335
- Update dev dependencies to latest version.

README.md

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,61 @@ SignalsJS
99
[![Greenkeeper badge](https://badges.greenkeeper.io/RobotlegsJS/SignalsJS.svg)](https://greenkeeper.io/)
1010
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
1111

12-
TypeScript port of [AS3 Signals](https://github.com/robertpenner/as3-signals).
13-
[13kb compressed](dist/signals.min.js).
12+
**SignalsJS** is a [TypeScript](https://www.typescriptlang.org/) port of [AS3 Signals](https://github.com/robertpenner/as3-signals).
13+
[15KB compressed](dist/signals.min.js).
14+
15+
About
16+
---
17+
18+
**Signals** are light-weight, strongly-typed messaging tools.
19+
Wire your application with better APIs and less boilerplate than normal event systems.
20+
21+
Concept
22+
---
23+
24+
* A **Signal** is essentially a mini-dispatcher specific to one event, with its own array of listeners.
25+
* A **Signal** gives an event a concrete membership in a class.
26+
* Listeners subscribe to real objects, not to string-based channels.
27+
* Event string constants are no longer needed.
28+
* **Signals** was originally implemented by [Robert Penner](https://github.com/robertpenner) in [AS3](https://github.com/robertpenner/as3-signals).
29+
* **Signals** are inspired by [C# events](http://en.wikipedia.org/wiki/C_Sharp_syntax#Events) and [signals/slots](http://en.wikipedia.org/wiki/Signals_and_slots) in Qt.
30+
31+
Syntax
32+
---
33+
34+
```typescript
35+
// with DOM EventListener
36+
button.addEventListener("click", onClick);
37+
38+
// Signal equivalent; past tense is recommended
39+
button.clicked.add(onClicked);
40+
```
41+
42+
Installation
43+
---
44+
45+
You can get the latest release and the type definitions using [NPM](https://www.npmjs.com/):
46+
47+
```bash
48+
npm install @robotlegsjs/signals
49+
```
50+
51+
Or using [Yarn](https://yarnpkg.com/en/):
52+
53+
```bash
54+
yarn add @robotlegsjs/signals
55+
````
1456

1557
Usage
1658
---
1759

18-
```ts
60+
```typescript
1961
import { Signal } from "@robotlegsjs/signals";
20-
var signal = new Signal();
62+
63+
let signal = new Signal();
2164
2265
signal.add(data => {
23-
console.log(data.message);
66+
console.log(data.message);
2467
});
2568
2669
signal.dispatch({ message: "hello signal!" });

0 commit comments

Comments
 (0)