5
5
Chrome devtools extension intended to display result of deep in-memory object
6
6
comparisons with the help of dedicated console commands.
7
7
8
+ ### Based on
9
+
10
+ - [ jsondiffpatch] ( https://github.com/benjamine/jsondiffpatch ) by Benjamín Eidelman
11
+ - [ vuejs] ( https://github.com/vuejs ) by Evan You
12
+
8
13
### Features
9
14
10
15
- compare objects from multiple tabs and/or between page reloads
11
16
- function code included in comparison result in form of a string, may help to see if it was altered
12
17
- document, dom-elements and other non-serializable objects are filtered-out from the results
13
18
- self recurring references displayed only once, the rest of occurrences are filtered-out
14
19
20
+ ### Limitations and workarounds
21
+
22
+ - some instances of objects may cause exception during preparations for comparison
23
+ - try to narrow compared contexts
24
+ - if it's some Browser API that causes an exception and not a framework, consider opening an issue,
25
+ so it will be possible to solve it on a permanent basis
26
+ - while paused in debug mode, JSDiff panel won't reflect the result until runtime is resumed ([ #10 ] [ i10 ] )
27
+
28
+ [ i10 ] : https://github.com/zendive/jsdiff/issues/10
29
+
15
30
### API
16
31
32
+ - ** console.diff(left, right)** - compare left and right arguments
33
+
34
+ ``` javascript
35
+ console .diff ({ a: 1 , b: 1 , c: 3 }, { a: 1 , b: 2 , d: 3 });
36
+ ```
37
+
38
+ - ** console.diffPush(next)** - shifts sides, right becomes left, next becomes right
39
+
40
+ ``` javascript
41
+ console .diffPush (Date .now ());
42
+ ```
43
+
44
+ - ** console.diff(next)** - shorthand for ` diffPush `
45
+
46
+ ``` javascript
47
+ console .diff (Date .now ());
48
+ ```
49
+
50
+ - ** console.diffLeft(left)** - update the old value
51
+
17
52
``` javascript
18
- console .diff (left, right); // compare left and right
19
- console .diff (next); // shorthand of diffPush while single argumented
20
- console .diffLeft (left); // update object on the left side only
21
- console .diffRight (right); // update object on the right side only
22
- console .diffPush (next); // shifts sides, right becomes left, next becomes right
53
+ console .diffLeft (Date .now ());
54
+ ```
55
+
56
+ - ** console.diffRight(right)** - update the new value
57
+
58
+ ``` javascript
59
+ console .diffRight (Date .now ());
23
60
```
24
61
25
62
### Usage basics
@@ -30,25 +67,16 @@ Historically, left side represents the old state and right side the new state.
30
67
- Things that are missing on the left side but present on the right side are colour-coded as green (new).
31
68
32
69
To track changes of the same variable in timed manner you can push it with ` diffPush ` or ` diff `
33
- with a single argument,
34
- that will shift objects from right to left, showing differences with previous push state.
70
+ with a single argument, that will shift objects from right to left, showing differences with previous push state.
35
71
36
72
### How it works
37
73
38
- - ` jsdiff-devtools ` registers devtools panel
39
- - injects console commands that send data to ` jsdiff-proxy `
40
- - injects ` jsdiff-proxy ` to farther communicate objects to the extension's ` jsdiff-background `
41
- - when ` console.diff ` command invoked
42
- - argument/s are cloned in a suitable form for sending between different window contexts and sent to ` jsdiff-proxy `
43
- - ` jsdiff-proxy ` catches the data and sends it to the ` jsdiff-background ` where it is stored for future consuming
44
- - when ` jsdiff-panel ` is mounted (visible in devtools) it listens to data expected to come from the ` jsdiff-background `
45
- and displays it
74
+ - ` jsdiff-devtools.js ` registers devtools panel
75
+ - injects ` console.diff ` commands into inspected window's console interface
76
+ - each function clones arguments and sends them via ` postMessage ` to ` jsdiff-proxy.js `
77
+ - injects ` jsdiff-proxy.js ` that listens on window message and sends it further to chrome runtime.
78
+ - when ` jsdiff-panel.js ` is visible in devtools, it reflects result of last invocation and listens for future messages
46
79
47
80
### Screenshot
48
81
49
82
![ screenshot] ( ./src/img/screenshot-01.png )
50
-
51
- ### Based on
52
-
53
- - [ jsondiffpatch] ( https://github.com/benjamine/jsondiffpatch ) by Benjamín Eidelman
54
- - [ vuejs] ( https://github.com/vuejs ) by Evan You
0 commit comments