Allotize

  • ?: optional
// Creates a shared state
Allotize.Crate({
    // URI for the resource
    route: 'String',
    // Specifies if the resource should be persisted
    persist: '?bool',
    // Callback when a change is made to the resouce
    onChange: '?function',
    // Callback for when a local change is made to the resouce
    onLocalChange: '?function',
    // Callback for when a remote change is made to the resouce
    onRemoteChange: '?function',
    // List of callbacks to call when a change is made to the resouce
    onChangeCallbacks: '?array[]function',
    // Throttle interval for sending and syncing changes
    throttleInterval: '?int (ms) [DEFAULT=350ms]',
    // Data for your resouce
    data: {
        field1: 'value1',
        field2: 'value2',
        ...,
        fieldN: 'valueN',
    }
})
// Returns connection information
Allotize.metadata()
// Returns all objects stored by Allotize
Allotize.get_all()
// Removes an item from Allotize by its key
Allotize.remove(key: 'String')