Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/taixw2/eventemitter
Dependency free publish/subscribe(pub/sub) for dart&flutter.
https://github.com/taixw2/eventemitter
Last synced: 5 days ago
JSON representation
Dependency free publish/subscribe(pub/sub) for dart&flutter.
- Host: GitHub
- URL: https://github.com/taixw2/eventemitter
- Owner: taixw2
- License: mit
- Created: 2018-11-21T09:16:17.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-22T00:52:32.000Z (almost 6 years ago)
- Last Synced: 2024-05-28T22:15:52.096Z (6 months ago)
- Language: Dart
- Size: 9.77 KB
- Stars: 4
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# eventemitter
Dependency free publish/subscribe(pub/sub) for dart&flutter.
## How to use
Open the `pubspec.yaml` file, and add `eventemitter:` unde dependencies:
``` yaml
dependencies:
flutter:
sdk: flutter
# ...
# ...
eventemitter: ^0.1.3
```
install it from terminal: `Run flutter packages get`## Example
- [example](./example/main.dart)
- [test](./test/eventemitter_test.dart)``` dart
String token = EventEmitter.subscribe('topic', (data) {
// receive 2
print(data);
});// publish is async function
EventEmitter.publish('topic', 1)
EventEmitter.publishSync('topic', 2)
EventEmitter.unsubscribe(token);```
## Link
- [https://github.com/mroderick/PubSubJS](https://github.com/mroderick/PubSubJS)
- [https://gist.github.com/juliangruber/3160726](https://gist.github.com/juliangruber/3160726)
- [https://github.com/primus/eventemitter3](https://github.com/primus/eventemitter3)