#rxjs-debugger
Intent
The intent of this repo is to make it easier to debug streams in a running application.
Some of the driving goals are:
- You should not need to install any special tools / chrome extensions to debug the app
- You should not need to restart the app / put it into debug mode
- Debugging should do as little as possible until something asks for the debug info (delay as much as possible)
- Debugging should not be able to break the app
- You should be able to use the debugger to change state
Getting Started
npm i @jhoguet/rxjs-debugger
then in your index file
import { extendObservable } from '@jhoguet/rxjs-debugger';
import { Observable } from 'rxjs';
extendObservable(Observable);
// now can add debug points to any stream or get a debugger... see api below
Next Steps / How to help
- explore options other than extending the Observable prototype, eg
bind
aka::
or a globalgetDebugger(forStream)
instead offorStream.getDebugger()
- research the risk of
.source
, is this a non-starter? are there better options? - catch up on todos
- companion UI library for visualizing the stream
- refactor to embrace fact that a subscription should be more first class than stream is, and that a subscription relies on 0 to many subscriptions (eg combineLatest and other aggregators)
- refactor tests in debugOperator.tests.js to be index.tests.js
- address memory leaks (eg in SubscriptionDebugger)
Stream Api
On any observable, there is now a debug
operator.
###stream.debug(name :string, description :string)
name | description |
---|---|
name | the name for this debug point in the stream |
description | a description to describe the value at this point in the stream |
stream.getDebugger(name :?string) :StreamDebugger
This will return the closest StreamDebugger
to the stream.
StreamDebugger
debugger.nextUpstream(name :?string)
debugger.nextDownstream(name :?string)
You cannot go further downstream than the original stream on which .getDebugger() was called
debugger.getSubscriptions()
SubscriptionDebugger
debugger.trace()
returns an array of TimestampedValues
for the most recent subscription for each debug
in the observable stream.
debugger.setValue(value)
sets the value on observable
StreamDebuggerApi
api.getDebugger(stream :Observable, name :?string)
Next Steps / How to help
- explore options other than extending the Observable prototype, eg
bind
aka::
or a globalgetDebugger(forStream)
instead offorStream.getDebugger()
- research the risk of
.source
, is this a non-starter? are there better options? - likely missing some documentation, what is missing? where is more depth needed?