TreeBoard

TreeBoard

Class TreeBoard

Constructor

new TreeBoard()

Source:

Extends

Members

board :Object.<string, *>

Source:
Overrides:
Type:
  • Object.<string, *>

nodes

Source:

get all NodeBoards

Methods

clear() → {Board}

Source:
Overrides:

Clear all data on board

Returns:

return itself

Type
Board

createNode(node) → {Board|undefined}

Source:

Create board for node

Parameters:
Name Type Description
node BaseNode | NodeId
Returns:

return created board, if failed, is returns undefined

Type
Board | undefined

gc() → {void}

Source:

Remove empty node memory

Returns:
Type
void

get(key) → {*}

Source:
Overrides:

find data by key

Parameters:
Name Type Description
key string

key to find data

Returns:

found data

Type
*

isEmpty() → {boolean}

Source:
Overrides:

Check this TreeBoard is empty or not It returns true when both tree memory and node memory are empty

Returns:
Type
boolean

listNode() → {Array.<NodeId>}

Source:

Returns list of NodeId

Returns:
Type
Array.<NodeId>

node(node, params) → {NodeBoard}

Source:
Parameters:
Name Type Description
node BaseNode | string
params object
Properties
Name Type Attributes Default Description
safe boolean <optional>
false

if this flag enabled, generate empty NodeBoard when cannot find node board

Returns:
Type
NodeBoard

removeNode(node) → {boolean}

Source:
Parameters:
Name Type Description
node BaseNode | NodeId
Returns:

deletion success or not

Type
boolean

set(key, value) → {Board}

Source:
Overrides:
Parameters:
Name Type Description
key string
value *
Returns:

return itself

Type
Board

toJSON(optsopt) → {object}

Source:
Overrides:
Parameters:
Name Type Attributes Description
opts object <optional>
Properties
Name Type Attributes Default Description
tree boolean <optional>
true
node boolean <optional>
true
Returns:
Type
object

unset(key) → {Board}

Source:
Overrides:

Delete specific data by key

Parameters:
Name Type Description
key string
Returns:

return itself

Type
Board