StartDebug

Start debug, so you can listen debug by using dobEvent. THis is a low level api.

Usage

1
2
3
4
5
6
7
import { startDebug, dobEvent } from "dob"

startDebug()

dobEvent.on("debug", debugInfo => {
console.log(debugInfo)
})

StopDebug

1
2
3
import { stopDebug } from "dob"

stopDebug()

The most common use is debug in dob-react

Defintion

IDebugInfo:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
interface IDebugInfo {
/**
* uniqueId, you can also receive it from `observe` or `reaction` callback first argument's field `debugId`
*/
id?: number
/**
* action's name
*/
name?: string
type: string
changeList?: Array<{
type: string
/**
* called child action in this action, when type is action
*/
action?: IDebugInfo
callStack: PropertyKey[]
oldValue?: any
/**
* new value
*/
value?: any
/**
* operate key
*/
key?: PropertyKey
customMessage?: any[]
}>
}