rxact-debugger
v1.0.0-beta.0
Published
Debugger for rxact
Downloads
5
Readme
Debugger for Rxact.
Installation
yarn add rxact
yarn add rxact-debugger --dev
Usage
There are two ways:
1. Install as a plugin
import { setup, StateStream } from 'rxact'
import { plugin as rxactDebugger } from 'rxact-debugger'
setup({
Observable: /** Observable lib you like **/,
plugins: [rxactDebugger()],
})
const stream = new StateStream('stream', { name: 'rxact' })
stream.debugger.start()
2. Enhance StateStream
import { setup, StateStream } from 'rxact'
import { decorator as rxactDebugger } from 'rxact-debugger'
const EnhancedStateStream = decorator()(StateStream)
setup({
Observable: /** Observable lib you like **/,
StateStream: EnhancedStateStream,
})
const stream = new EnhancedStateStream('stream', { name: 'rxact' })
stream.debugger.start()
And you can access state streams in browser developer console
via:
window.rxactDebugger.user // assume you have a stateStream named user
API
plugin(options)
plugin(options: {
start?: boolean | Array<stateStreamName: string>,
})
Return a StateStream plugin.
options: An object contain options.
| Property | Type | Description | Default | | ------------- | ---- | ----------- | ------- | | start | bool/array | start logger default or not. If value is an array of name of state stream, it will only start logger of these state streams. | false |
decorator(options)
decorator(options: {
start: ?boolean | Array<stateStreamName: string>,
})
Return a function for wrapping StateStream.
- options: As same as plugin's options.
stateStream.debugger
stateStream.debugger: {
start: Function,
stop: Function,
}
An debugger object, contains start
and stop
function.
- start: start logging.
- stop: stop logging.