jsondata¶
-
class
JSONData
(key[, workspace])¶ Extends: Emitter The mannager of a JSONData object saved to the server.
Arguments: - key (String) – The key of the data-object
- workspace (Workspace|Int) – If given, the workspace or its id for which the object is stored.
-
read-only
key
¶ Type: String The key of the JSONData object.
-
read-only
wid
¶ Type: Int The workspace id of the JSONData object.
-
data
¶ Type: Any The data content of the JSONData object.
-
pull
([, callback])¶ Instructs the JSONData to be fetched from the server. The callback is triggered when the pull has finished.
Emits pulled: When the pull has finished.
-
push
([, callback])¶ Instructs the JSONData to be sent to the server. The callback is triggered when the push has finished. Will not do anything (except calling the callback) when there is nothing to do.
Emits pulled: When the push has finished.
-
load
(infos)¶ Sets up the JSONData objects for the given keys in infos. This will internally call ;js:function:loadKey.
Arguments: - infos (Object(key=>JSONDataInfos)) – Has a infos objects with the same syntax as
in
loadKey()
for every key.
- infos (Object(key=>JSONDataInfos)) – Has a infos objects with the same syntax as
in
-
loadKey
(key, JSONDataInfos)¶ Sets up the JSONData obejct for the given workspaces in JSONDataInfos.
Arguments: - => JSONDataInfo) JSONDataInfos (Object(workspace.id) – Every key holds a JSONData info object (and internal data collection) from which it is initialized.
-
getInst
(key[, workspace])¶ Retrives the JSONData instance for the given key and workspace. It will be created if it does not already exist. This should be preferred over directly instanciating
JSONData()
itself.Arguments: - key (String) – The key of the JSONData.
- workspace (Workspace|Int(workspace.id)) – The workspace the JSONData is bound to. If omitted, it will be global.
Returns: The requested JSONData.
Return type: JSONData
-
syncObj
(key[, push])¶ Access to synchronous data objects for a given key. To be used with VueJS.
Arguments: - key (String) – The key of the JSONData group to update.
- push (Boolean) – If true, all the JSONData objects will be instructed to push their data.
Returns: The synchronous data object for the given key.
Return type: Object(workspace.id => Any)