This repository provides demonstrations of RxJS. The repository includes the following demos:
- src/demos/promise.ts - Using a promise.
- src/demos/observable.ts - Creating a simple
Observable
. - src/demos/subject.ts - Creating a
Subject
with a late subscription. - src/demos/async-subject.ts - Creating an
AsyncSubject
. - src/demos/behavior-subject.ts - Creating a
BehaviorSubject
. - src/demos/replay-subject.ts - Creating a
ReplaySubject
. - src/demos/observable-unicast.ts - Observables are unicast by default.
- src/demos/subject-multicast.ts - We can use a subject to make an observable hot and multicast.
- src/demos/observable-cold.ts - Observables are cold by default.
- src/demos/observable-hot-1.ts - We can make an observable hot and multicasted by a shared provider.
- src/demos/observable-hot-2.ts - We can make an observable hot and multicasted by using the
share()
operator.
To run the demos you need to first install the dependencies. Run the install command from the root of your working copy:
$ yarn install
You can run each demo by uncommenting the appropriate import statement in the src/index.ts
file.
To view a demo, run the webpack dev server, via:
$ yarn start:dev
Then browse to http://localhost:8080
The hot vs cold observable demos use socket.io. Start the socket.io server via:
$ yarn start:server
This will create a socket.io server listening on port 3000.