Skip to content

Commit

Permalink
Update test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lxsmnsyc committed Sep 8, 2023
1 parent 739f628 commit a90b0c4
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions packages/seroval/test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@

import { serialize, Feature } from './dist/esm/development/index.mjs';
import { Serializer } from './dist/esm/development/index.mjs';

const example = [
Symbol.iterator,
Symbol.iterator,
Symbol.iterator,
Symbol.iterator,
Symbol.iterator,
];

console.dir(serialize(example, {
disabledFeatures: Feature.ObjectAssign,
}), {
depth: null
const serializer = new Serializer({
globalIdentifier: '__SOLID__',
onHeader(value) {
console.log('HEADER', value);
},
onData(value) {
console.log([value]);
},
});

const delay = (value, ms) => new Promise(r => setTimeout(r, ms, value));

const source = {
a: delay('A', 300),
b: delay('B', 200),
c: delay('C', 100),
};

serializer.write('1', source);

0 comments on commit a90b0c4

Please sign in to comment.