Class MetaViewCollection

The 'MetaView Collection' class defines the collection that manages the view entity. This class provides the ability to add meta-views and check the presence of views in the collection.

Hierarchy (view full)

Constructors

  • Creates a 'MetaViewCollection' object. This object creates a collection that manages view entities.

    Parameters

    • owner: object

      Specifies the owner object of this collection.

    Returns MetaViewCollection

Properties

_baseType: MetaView

'MetaView' object used as the default generation type. This property defines the default type of view entity.

_elemTypes: any[]

Defines the type constraints for the collection element.

_guid: string

Unique identifier of the object (GUID). Uniquely identifies the object.

_list: any[]

An array that stores a list of elements in a collection. This array contains actual data from the collection.

_owner: object

Owned object of the collection.

_type: Function

The generator function of the object. The function used when the object was created.

$keys: string[]

Stores the key values of the collection element in an array.

count: number

Returns the number of elements in the current collection.

length: number

Returns the number of elements in the current collection.

_NS: string

Indicates the namespace.

'Meta'
_PARAM: []

List of parameters used for the constructor.

_UNION: []

List of implemented interfaces.

[IObject, IMarshal]

Methods

  • Protected

    Default descriptor set when adding elements to a collection.

    Parameters

    • idx: number

      Index of the element to which the technician will be imported.

    Returns object

  • Generates an 'onAdd' event.

    Parameters

    • idx: number

      Index of the element to be added.

    • elem: any

      The element to add.

    Returns void

    BaseCollection#onAdd

  • Generates an 'onAdd' event.

    Parameters

    • idx: number

      Index of added elements.

    • elem: any

      Added element.

    Returns void

    BaseCollection#onAdded

  • Generates an 'onChanged' event.

    Parameters

    • idx: number

      Index of the changed element.

    • elem: any

      Changed element.

    Returns any

    BaseCollection#onChanged

  • Generates an 'onChanging' event.

    Parameters

    • idx: number

      Index of the element to be changed.

    • elem: any

      The element to be changed.

    Returns any

    BaseCollection#onChanging

  • Generates an 'onClear' event.

    Returns any

    BaseCollection#onClear

  • Generates an 'onCheared' event.

    Returns any

    BaseCollection#onCleared

  • Create an 'onRemove' event.

    Parameters

    • idx: number

      Index of the element to be deleted.

    • elem: any

    Returns void

    BaseCollection#onRemove

  • Generates an 'onRemoved' event.

    Parameters

    • idx: number

      Index of the element to be deleted.

    • elem: any

      The element to delete.

    Returns void

    BaseCollection#onRemoved

  • Deletes an element in a specified location in the collection. Use the template method pattern to perform the deletion.

    Parameters

    • pos: number

      Index of the element to be deleted.

    Returns boolean

    This is a Boolean value that indicates whether element deletion is successful or not.

    const success = myCollection._remove(1);
    console.log(`Delete element successful: ${success}`);
  • Adds a view entity to the collection. The view to be added may be a view name (string) or 'MetaView' object.

    • String: Register as the name of the string after generation
    • String, Collection: Registered under the name of the string after generation (collection sent)
    • entityView: Register as an entityView name
    • entityView, collection: Register with entityView name (collection sent) => Error occurs

    Parameters

    • view: string | MetaView

      View to be added. You can receive objects of the type 'MetaView' or the name of the view (string).

    • baseEntity: BaseColumnCollection

      Default column collection. Object of type 'BaseColumnCollection'.

    Returns number

    The index of the added view. The index represents the location of the view within the collection.

    const index1 = collection.add("viewName", baseCollection); // Add a view with a string (view name)
    const index2 = collection.add(new MetaView("viewName"), baseCollection); // `MetaView` 객체로 뷰 추가
  • Initialize the property collection. This method initializes the array '$elements', '$descriptors', and '$keys'. The event is not initialized.

    Returns void

    myCollection.clear();
    console.log(myCollection.count); // 0
  • Verify that the element exists in the collection.

    Parameters

    • elem: any

      This is the element to check.

    Returns boolean

    This is a Boolean value indicating the presence or absence of an element.

    const exists = myCollection.contains(someElement);
    console.log(`element exists: ${exists}`);
  • Compare the current object with the specified object.

    Parameters

    • target: object

      the object to be compared to.

    Returns boolean

    Returns whether the two objects are the same.

  • Test that all elements pass the test implemented with the provided function.

    Parameters

    • callback: ((value: any, index: number, array: this) => any)

      콜백함수 입니다. (currentValue, index, array) => boolean

        • (value, index, array): any
        • Parameters

          • value: any
          • index: number
          • array: this

          Returns any

    • OptionalthisArg: any

      The value to use as this when executing the callback function.

    Returns boolean

    True if you return a true value for all array elements, otherwise false.

  • Verify that the specified key exists in the property collection.

    Parameters

    • key: string

      Key to check. Bulian value indicating the presence or absence of the

    Returns boolean

    key.

  • Determines whether the specified view name exists in the collection.

    Parameters

    • key: string

      The name of the view to check.

    Returns boolean

    Returns 'true' if the view name exists in the collection, or 'false'.

    constructs = collection.existViewName("viewName"); // Check the existence of the view name "viewName"
    
  • Filter only to elements that have passed the test implemented by the provided function

    Parameters

    • callback: ((value: any, index: number, array: this) => any)

      콜백함수 입니다.(currentValue, index, array) => boolean

        • (value, index, array): any
        • Parameters

          • value: any
          • index: number
          • array: this

          Returns any

    • OptionalthisArg: any

      The value to use as this when executing the callback function.

    Returns any[]

    Returns a new array of results.

  • Returns the first element that satisfies the provided test function

    Parameters

    • callback: ((value: any, index: number, array: this) => any)

      This is the callback function. (currentValue, index, array) => any

        • (value, index, array): any
        • Parameters

          • value: any
          • index: number
          • array: this

          Returns any

    • OptionalthisArg: any

      The value to use as this when executing the callback function.

    Returns any

    The first element in the array that satisfies the test function. If no element satisfies the test function, undefined is returned.

  • Returns the first element that satisfies the provided test function

    Parameters

    • callback: ((value: any, index: number, array: this) => any)

      콜백함수 입니다. (currentValue, index, array) => boolean

        • (value, index, array): any
        • Parameters

          • value: any
          • index: number
          • array: this

          Returns any

    • OptionalthisArg: any

      The value to use as this when executing the callback function. Index of the first element that passes the @returns{number} test. If no match exists, return -1.

    Returns any

  • Run the function provided for each element once.

    Parameters

    • callback: ((value: any, index: number, array: this) => void)

      This is the callback function. (currentValue, index, array) => void

        • (value, index, array): void
        • Parameters

          • value: any
          • index: number
          • array: this

          Returns void

    • OptionalthisArg: any

      The value to use as this when executing the callback function.

    Returns void

  • Returns properties collection objects as serialized objects. Circular references are replaced by $ref values.

    Parameters

    • OptionalvOpt: number

      Serialization option.

      • 0: Reference structure (_guid: Yes, $ref: Yes)
      • 1: Redundant structure (_guid: Yes, $ref: Yes)
      • 2: Non-tidal rescue (_guid: no, $ref: no)
    • Optionalowned: object | object[]

    Returns object

    serialized object.

    const serializedObj = collection.getObject(2);
    console.log(serializedObj);
  • Returns the creators of the current object and all the creators of the prototype chain to the array.

    Returns Function[]

    Returns the array of generator functions.

    const types = obj.getTypes();
    console.log(types); // [Function: MetaObject]
  • Look up an element in the collection.

    Parameters

    • Optionalelem: any

      The element to look up.

    Returns number

    Index of element. If element does not exist, return -1.

    const index = myCollection.indexOf(someElement);
    console.log (index of element: ${index});
  • Returns the key corresponding to the index of the property collection.

    Parameters

    • idx: number

      Index value to query.

    Returns string

    Key corresponding to index. You can return 'undefined' if the index is out of range.

    const key = myCollection.indexToKey(0);
    console.log(key for index 0: ${key}');
  • Verify that the current object is an instance of the specified type (including _UNION)

    Parameters

    • target: string | object

      The type of object to be checked (object or string).

    Returns boolean

    Returns whether it is an instance of the specified type.

  • Returns the index of the key or element specified in the property collection.

    Parameters

    • key: string

      key This is the key to look up.

    Returns number

    Index of element . Returns '-1' if element does not exist.

    const index = myCollection.keyToIndex("key1");
    console.log(`Index of key: ${index}`);
  • Collects the results of calling a given function for each element and returns a new array.

    Parameters

    • callback: ((value: any, index: number, array: this) => any)

      This is the callback function (currentValue, index, array) => any[]

        • (value, index, array): any
        • Parameters

          • value: any
          • index: number
          • array: this

          Returns any

    • OptionalthisArg: any

      The value to use as this when executing the callback function.

    Returns any[]

    Returns a new array of results.

  • Run the given reducer function for each element and return one result.

    Parameters

    • callback: ((value: any, index: number, array: this) => any)

      콜백함수 입니다. (accumulator, currentValue, index, array) => any

        • (value, index, array): any
        • Parameters

          • value: any
          • index: number
          • array: this

          Returns any

    • OptionalinitialValue: any

      Use the first element of the array if it does not provide an initial value.

    Returns any

    Returns a new array of results.

  • Delete an element in the collection.

    Parameters

    • elem: any

      The element to delete.

    Returns number

    Index of deleted elements.

    const removedIndex = myCollection.remove(someElement);
    console.log(`Index of deleted element: ${removedIndex}`);
  • Deletes an element in the specified location from the collection.

    Parameters

    • pos: number

      Index of the element to be deleted.

    Returns boolean

    This is a Boolean value that indicates whether element deletion is successful or not.

    const success = myCollection.removeAt(0);
    console.log(`Delete element successful: ${success}`);
  • Initialize the property collection object using serialized objects. During this process, the object is initialized.

    Parameters

    • oGuid: object

      serialized object.

    • Optionalorigin: object

      Original object. Default is 'oGuid'.

    Returns void

  • Test that at least one element passes through a given discriminant function.

    Parameters

    • callback: ((value: any, index: number, array: this) => any)

      콜백함수 입니다. (currentValue, index, array) => boolean

        • (value, index, array): any
        • Parameters

          • value: any
          • index: number
          • array: this

          Returns any

    • OptionalthisArg: any

      The value to use as this when executing the callback function.

    Returns boolean

    Returns true if you return a true value for one element, or false.

Events

onAdd: ((idx: number, elem: any, _this: object) => void)

Events that occur before adding an element to a collection.

BaseCollection#onAdd

Type declaration

    • (idx, elem, _this): void
    • Parameters

      • idx: number

        Index of the element to be added.

      • elem: any

        The element to add.

      • _this: object

        current collection object.

      Returns void

myCollection.onAdd = function(idx, elem, _this) {
console.log(`Before adding elements: index ${idx}, element ${elem}`);
};
onAdded: ((idx: number, elem: any, _this: object) => void)

Events that occur after you add an element to a collection.

BaseCollection#onAdded

Type declaration

    • (idx, elem, _this): void
    • Parameters

      • idx: number

        Index of added elements.

      • elem: any

        Added element.

      • _this: object

        current collection object.

      Returns void

myCollection.onAdded = function(idx, elem, _this) {
console.log ('After adding elements: index ${idx}, element ${elem}');
};
onChanged: ((idx: number, elem: any, _this: object) => void)

Events that occur after you change an element in a collection.

BaseCollection#onChanged

Type declaration

    • (idx, elem, _this): void
    • Parameters

      • idx: number

        Index of the changed element.

      • elem: any

        Changed element.

      • _this: object

        current collection object.

      Returns void

myCollection.onChanged = function(idx, elem, _this) {
console.log ('After element change: index ${idx}, element ${elem}');
};
onChanging: ((idx: number, elem: any, _this: object) => void)

An event that occurs before you change an element in a collection.

BaseCollection#onChanging

Type declaration

    • (idx, elem, _this): void
    • Parameters

      • idx: number

        Index of the element to be changed.

      • elem: any

        The element to be changed.

      • _this: object

        current collection object.

      Returns void

myCollection.onChanging = function(idx, elem, _this) {
console.log(`Before element change: index ${idx}, element ${elem}`);
};
onClear: ((_this: object) => {})

Events that occur before the collection is initialized.

BaseCollection#onClear

Type declaration

    • (_this): {}
    • Parameters

      • _this: object

        current collection object.

      Returns {}

    myCollection.onClear = function(_this) {
    console.log ('Before collection initialization);
    };
    onCleared: ((_this: object) => {})

    Events that occur after the collection is initialized.

    BaseCollection#onCleared

    Type declaration

      • (_this): {}
      • Parameters

        • _this: object

          current collection object.

        Returns {}

      myCollection.onCleared = function(_this) {
      console.log ('After collection initialization');
      };
      onRemove: ((idx: number, elem: any, _this: object) => void)

      An event that occurs before an element is deleted from the collection.

      BaseCollection#onRemove

      Type declaration

        • (idx, elem, _this): void
        • Parameters

          • idx: number

            Index of the element to be deleted.

          • elem: any

            The element to delete.

          • _this: object

            current collection object.

          Returns void

      myCollection.onRemove = function(idx, elem, _this) {
      console.log(`Before element deletion: index ${idx}, element ${elem}`);
      };
      onRemoved: ((idx: number, elem: any, _this: object) => void)

      Events that occur after you delete an element from a collection.

      BaseCollection#onRemoved

      Type declaration

        • (idx, elem, _this): void
        • Parameters

          • idx: number

            Index of deleted elements.

          • elem: any

            Deleted element.

          • _this: object

            current collection object.

          Returns void

      myCollection.onRemoved = function(idx, elem, _this) {
      console.log(`After element deletion: index ${idx}, element ${elem}`);
      };