Javascript SharedObjects
(One intermediate revision by one user not shown) | |||
Line 7: | Line 7: | ||
See [[Javascript Object|Object]].assignProps() function. | See [[Javascript Object|Object]].assignProps() function. | ||
+ | |||
== Constructor == | == Constructor == | ||
Line 67: | Line 68: | ||
'''owned''' Boolean. True if calling script is owning the variable, false otherwise.<br/> | '''owned''' Boolean. True if calling script is owning the variable, false otherwise.<br/> | ||
'''persistent''' Boolean. True if variable is persistent (will not be deleted if script creating it is unloaded), false otherwise.<br/> | '''persistent''' Boolean. True if variable is persistent (will not be deleted if script creating it is unloaded), false otherwise.<br/> | ||
+ | |||
[[Category:Javascript]] | [[Category:Javascript]] |
Latest revision as of 12:41, 9 September 2024
[edit] General
SharedObjects object implements an interface to a common list holding objects shared between scripts.
When set the module keeps a copy of the value.
Where retrieved the module returns a copy of the value.
See Object.assignProps() function.
[edit] Constructor
- new Engine.SharedObjects
Create an object implementing the interface to shared objects.
[edit] Methods
- get(name)
Retrieve a copy of a shared object.
Parameters:
name Object name.
Return:
Object (deep copy of existing) or null if not found.
- set(name,obj[,persistent[,assignPropsFlags]])
- create(name,obj[,persistent[,assignPropsFlags]])
Set or create a shared object.
create does not replace an existing object.
The shared objects list will always keep a deep copy of the given object.
Parameters:
name Object name.
obj Object value. Must be a non null object.
persistent Boolean. True if object is persistent (will not be deleted when script is unloaded). False to delete object when script is unloaded. Default: false.
assignPropsFlags Integer. Flags to be passed to Object.assignProps() function. Object.AssignDeepCopy and Object.AssignFreezeCopy will be forced by javascript.
Return:
Numeric number of copied properties. Negative if not set/created.
- clear(name)
Parameters:
name Object name.
- clearAll([owned])
Clear all shared objects.
Parameters:
owned Boolean. True to clear owned objects only. False to clear all shared objects.
- exists(name)
Parameters:
name Object name.
Return:
True if object exists, false otherwise.
- description(name)
Retrieve the description of a shared object.
Parameters:
name Object name.
Return:
Object with variable description, null if not found.
Description:
name Object name.
owned Boolean. True if calling script is owning the variable, false otherwise.
persistent Boolean. True if variable is persistent (will not be deleted if script creating it is unloaded), false otherwise.