v7.3.0

DynamicObject
internal

This class is used to manage dynamic creation and configuration of individual properties of an object. This pattern is used to allow the names of an object to each represent a dynamically instantiated object. For example, the features config of Calendar is defined like so:

 class Calendar extends ... {
     static configurable = {
         features : {
             drag : {
                 // configs for Drag feature
             }
         }
     };
 }

This class is used to manage the features objects in the above case. The drag property value is promoted from the config object defined by the class and user instance on first request. Like config properties themselves, these features may access other features during their initialization. These accesses are trapped by this class to ensure the config object is promoted to an instantiated instance.

A factory is provided to this object to allow it to create instances from names like 'drag'.

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • Optional name of the config property managed by this instance. If changes are made directly, this property is used to run the onConfigChange method of the owner.

  • The factory to use to create instances.

  • By default, the name of the member is used for the type. Set this config to true to also allow the config object for a property to contain a type property. Set this to false to ignore the name of the member and rely on the factory to process the config object.

  • The owning object to pass along to the instances as the ownerName property.

  • The property name by which to store the owner on each instance.

  • proxyable : Boolean
    private

    Set to false to prevent using a Proxy even if that JavaScript platform feature is available. Using a Proxy is ideal because it allows for all forms of access to the dynamic properties to be handled instead of only those that have predefined configuration values.

Properties

Properties are getters/setters or publicly accessible variables on this class
    • defaults : Object
      private

      Holds config objects for each defined object. These are used to hold class and instance config values and use them to create instances on first request, or when flush() is called. Further, if the instance is initially assigned instead of retrieved, these values act as the defaults for the instance and are combined with those provided in the assignment.

    • instances : Object
      private

      This object holds the actual instances that are retrieved by the dynamic accessor or Proxy.

    • object : Object
      private

      The object that contains the dynamic accessors for each instance. This object is not used when using a Proxy.

    • proxy : Proxy
      private
      READONLY

      Returns the Proxy instance used to manage dynamic assignments. If the JavaScript platform does not support the Proxy class, this will be null.

    • target : Object
      internal
      READONLY

      Returns the object that contains the dynamic properties. This may be a Proxy instance or an object with getter and setter accessors.

    Functions

    Functions are methods available for calling on the class
      • flush( )
        internal

        Ensures that all defined members are touched to trigger their creation.

      Source path

      Core/util/DynamicObject.js

      Contents