https://github.com/spro/most-bus
A pushable, pluggable stream for Most.js
https://github.com/spro/most-bus
Last synced: 5 months ago
JSON representation
A pushable, pluggable stream for Most.js
- Host: GitHub
- URL: https://github.com/spro/most-bus
- Owner: spro
- Created: 2015-07-06T23:45:09.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-12-29T22:08:31.000Z (over 10 years ago)
- Last Synced: 2026-01-18T17:54:08.908Z (5 months ago)
- Language: CoffeeScript
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# most-bus
A pushable, pluggable stream for [Most.js](https://github.com/cujojs/most). Deprecated - you should use [most-subject](https://github.com/TylorS/most-subject) instead.
# Usage
```coffee
bus = require 'most-bus'
# Create a bus
bus$ = bus()
# Create some streams to plug in
odd$ = most.from([1,3,5]).delay(50)
even$ = most.from([4,6,8]).delay(100)
hello$ = most.periodic(400, 'hello')
# Plug in the streams
bus$.plug odd$
bus$.plug even$
unplug_hello = bus$.plug hello$ # .plug returns an unplug function
# Push something directly onto the bus
bus$.push 'something'
# Unplug a stream
setTimeout unplug_hello, 900
```