Struct

APIStruct

Access it with:

const { Struct } = Neft;

Source

Struct::constructor(object)

Parameters:
  • object — Object

Creates a new struct instance with the given properties.

Once created struct keys cannot be added or removed.

Each key is created with his onChange signal.

var struct = new Struct({ name: 'Max' });
struct.name; // 'Max'
struct.onNameChange.connect((oldValue) => {
    console.log(`Name changed from ${oldValue} to ${struct.name}`)
})
struct.name = 'Bob'
// prints 'Name changed from Max to Bob'

Source