get(id)

Gets data in a node.

Parameters

  • id (string) - string id of a node.

Returns

  • (anything) - data in the node.

Examples

import Treeful from 'treeful';

Treeful.add('n1')
       .add('n2', 'value');

let d1 = Treeful.get('n1'); // d1 == null
let d2 = Treeful.get('n2'); // d2 == 'value'

Tip 1: Use get to read latest data at a specific moment only. If you wish to get latest data at all times, use subscribe instead.

import Treeful from 'treeful';

Treeful.add('n1', 0);

let d1 = Treeful.get('n1'); // d1 == 0

// Meanwhile, other component updates data in node 'n1'.
// WARNING. d1 contains an outdated data.

results matching ""

    No results matching ""