Javascript SharedObjects

From Yate Documentation
Revision as of 13:41, 9 September 2024 by Marian (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.


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 (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.

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers