Bind Model Ajax Class This class inherits BaseBindModel and provides additional functionality for Ajax communication.

Hierarchy (view full)

Constructors

Properties

_baseTable: MetaTable

Defines the default entity. This entity represents a meta table.

_columnType: MetaColumn

Sets the column type.

_guid: string

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

A collection of mapping properties.

This is a meta table collection. Manage multiple meta tables.

_type: Function

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

$event: EventEmitter

Event object. Processes the issuance and reception of events.

$KEYWORD: string[]

This is the collection reservation word. Defines the reserved words that you use by default.

baseConfig: object

Set the binding default config.

cbBaseBegin: ((command: BaseBindCommand) => void)

Default callback function called at the start of execution (used when cbBegin callback function is not present)

Type declaration

    • (command): void
    • Parameters

      Returns void

cbBaseBind: ((bind: MetaView, command: BaseBindCommand, config: object) => void)

Default callback function called before bind (used when cbBind callback function is not present)

Type declaration

    • (bind, command, config): void
    • Parameters

      • bind: MetaView

        object 'MetaView' to bind.

      • command: BaseBindCommand

        The current bound command object.

      • config: object

        setting object.

      Returns void

cbBaseEnd: ((status: object, command: BaseBindCommand, response: object) => void)

Default callback function called after completion of execution (used when cbEnd callback function is not present)

Type declaration

    • (status, command, response): void
    • Parameters

      • status: object

        Object containing status information.

      • command: BaseBindCommand

        The current bound command object.

      • response: object

        response object.

      Returns void

cbBaseOutput: ((outputs: MetaViewCollection, command: BaseBindCommand, response: object) => object)

Default callback function to output bind results (used when cbOutput callback function is not present)

Type declaration

    • (outputs, command, response): object
    • Parameters

      Returns object

      Returns the processed result object.

cbBaseResult: ((data: object, command: BaseBindCommand, response: object) => object)

Callback function that handles binding results (used in the absence of the cbResult callback function)

Type declaration

    • (data, command, response): object
    • Parameters

      • data: object

        Bind result data object.

      • command: BaseBindCommand

        The current bound command object.

      • response: object

        response object.

      Returns object

      Returns the processed result object.

cbBaseValid: ((valid: MetaView, command: BaseBindCommand) => boolean)

Default callback function called before valid (used without cbValid callback function)

Type declaration

    • (valid, command): boolean
    • Parameters

      Returns boolean

      A boolean value indicating the result of the examination.

cbError: ((msg: string, status: object, response: object) => void)

The callback function that is called in the event of an error.

Type declaration

    • (msg, status, response): void
    • Parameters

      • msg: string

        Error message.

      • status: object

        Object containing status information.

      • response: object

        response object.

      Returns void

cbFail: ((result: object, column: MetaColumn) => void)

Callback function called upon failure by valid.

Type declaration

    • (result, column): void
    • Parameters

      • result: object

        object containing the results of the examination.

      • column: MetaColumn

        object 'MetaColumn' used in the examination.

      Returns void

Alias for command.

Collection of columns. Indicates the column of the _baseTable.

A collection of binding commands.

first: MetaTable

This is the first dynamically generated meta table.

A collection of bound model functions. (Internal function + Exposure function)

It's an item collection.

preCheck: ((model: BaseBindModel) => boolean)

Callback function that returns boolean on init() call.

Type declaration

    • (model): boolean
    • Parameters

      Returns boolean

      A boolean value indicating the result of the examination.

preReady: ((model: BaseBindModel) => void)

Callback function called when preCheck callback function result is true when invoking init().

Type declaration

    • (model): void
    • Parameters

      Returns void

preRegister: ((model: BaseBindModel) => void)

The callback function that is initially called upon init() call.

Type declaration

    • (model): void
    • Parameters

      Returns void

url: string

Set the binding default config.url.

const bm = new BindModel(service);
bm.url = '/user';
_NS: string

Indicates the namespace.

'Meta'
_PARAM: []

List of parameters used for the constructor.

_UNION: []

List of implemented interfaces.

[IObject, IMarshal]

Methods

  • Register (load) the property to the _baseTable or the specified MetaTable.

    Parameters

    • Optionalitems: string | string[]

      The name of the item to read. It can be string or string array.

    • OptionalbaseEntity: MetaTable

      Default table object. (Optional)

    Returns void

  • Add columns and map them to commands.

    Parameters

    • column: MetaColumn

      This column object is to be registered. It could be a string or 'MetaColumn' object.

    • Optionalcmds: string | string[]

      (Optional) Command that specifies the location of the view. It can be a string or string array.

    • Optionalviews: string | string[]

      (Optional) The name of the view entity to be added. It can be a string or an array of strings.

    • OptionalbTable: string | MetaTable

      (Optional) Default table object or table name to be mapped.

    Returns void

  • Add columns and values, add them to the specified table, and register the reference to the column in BaseBindcommand's valid, bind, and output MetaView.

    @param{string} name - The name of the column. @param{any} value - column value.

    Parameters

    • name: string
    • value: any
    • Optionalcmds: string | string[]

      This command specifies the location of the view. It can be a string or an array of strings.

    • Optionalviews: string | string[]

      The name of the view entity to be added. It can be a string or an array of strings.

    • OptionalbTable: string | MetaTable

      (Optional) Default table object or table name to be mapped.

    Returns void

  • Examine the selector.

    Parameters

    Returns boolean

    A boolean value indicating the result of the examination.

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

  • Obtain the current object as a guide type object. (Circular references are replaced by $ref values.)

    Parameters

    • OptionalvOpt: number

      is the import option. Default is 0.

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

    Returns object

    Returns serialized objects.

    a.getObject(2) == b.getObject(2)
    
  • Obtain a list of destination selectors.

    Parameters

    • Optionalcollection: PropertyCollection

      This is the collection of properties to examine. The default is items.

    Returns object[]

    Object array representing the selector list.

  • 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]
  • 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.

  • Sets the Guid type object to the current object. (The object will be reset.)

    Parameters

    • oGuid: object

      Object of the guid type to serialize.

    • Optionalorigin: object

      The source object setting the current object. (Optional)

    Returns void

Events

onExecute: ((cmd: BaseBindCommand) => void)

An event that is called before the command is executed.

Type declaration

    • (cmd): void
    • Parameters

      Returns void

onExecuted: ((cmd: BaseBindCommand, result: object) => void)

An event that is called after the command is executed.

Type declaration

    • (cmd, result): void
    • Parameters

      • cmd: BaseBindCommand

        Command object executed.

      • result: object

        The result object of the command execution.

      Returns void