File tree Expand file tree Collapse file tree 1 file changed +25
-4
lines changed
Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change 1- import { serialize } from ' ./dist/esm/development/index.mjs' ;
1+ import { toCrossJSONStream , fromCrossJSON , crossSerializeStream } from " ./dist/esm/development/index.mjs" ;
22
3- const example = { } ;
3+ const delay = ( delay , value ) => new Promise ( ( resolve ) => {
4+ setTimeout ( ( ) => resolve ( value ) , delay )
5+ } )
46
5- example [ NaN ] = example ;
7+ const bla = {
8+ a : 'Hello' ,
9+ b : delay ( 1000 , "World" ) ,
10+ c : delay ( 2000 , "Bla" ) ,
11+ d : delay ( 3000 , {
12+ e : 2500
13+ } )
14+ }
615
7- console . log ( serialize ( example ) ) ;
16+ const refs = new Map ( ) ;
17+
18+ toCrossJSONStream ( bla , {
19+ onParse ( node , initial ) {
20+ console . log ( fromCrossJSON ( node , { refs } ) )
21+ }
22+ } ) ;
23+
24+ // crossSerializeStream(bla, {
25+ // onSerialize(node) {
26+ // console.log(node);
27+ // }
28+ // })
You can’t perform that action at this time.
0 commit comments