Javascript SharedObjects
(→General) |
(→General) |
||
Line 1: | Line 1: | ||
== General == | == General == | ||
− | Shared objects | + | |
+ | Shared objects are kept and returned copy | ||
See [[Javascript Object|Object]].assignProps() function. | See [[Javascript Object|Object]].assignProps() function. | ||
− | |||
− | |||
− | |||
− | |||
== Constructor == | == Constructor == |
Revision as of 15:08, 3 September 2024
General
Shared objects are kept and returned copy
See Object.assignProps() function.
Constructor
- new Engine.SharedObjects
Create an object implementing the interface to shared objects.
Methods
- get(name)
Retrieve a copy of a shared object.
Parameters:
name Object name.
Return:
Object 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 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.