web/docs/api/javascript/createnode.md at master · DistributedObjectProtocol/web

Skip to content

Navigation Menu

Sign in

Appearance settings

Latest commit

File metadata and controls

29 lines (18 loc) · 569 Bytes

createNode( [options] )

Creates a new Node.

Arguments

[options] Object

  • serialize function By default is JSON.stringify

  • deserialize function By default is JSON.parse

  • rpcFilter function Can be used to block or manipulate the rpc that is going to be created.

Returns Object

A new Node instance.

Example

import { createNode } from 'dop'

const node = createNode({ 
    serialize: JSON.stringify,
    deserialize: JSON.parse,
    rpcFilter: ({ rpc }) => rpc,
})