NodesRef: invoke() method

Execute the UI method of the selected node.

Please note that the UI function is a function provided by the client, usually directly controlling UI functions, such as the play or stop of the player. invoke cannot be used to call a js function of a custom component.

Syntax

invoke(options: Record<string, any>): SelectorQuery;

Parameters

options

The options parameter is a Record<string, any>, which contains the information needed for the execution of the UI method. Its key list is as follows:

  • method

  • A string, the name of the UI method to be called

  • params (optional)

  • A Record<string, any>, the parameters of the UI method to be called

  • success (optional)

  • A callback function that is called when the UI method is successfully executed, with the first parameter being the result returned by the UI method

  • fail (optional)

  • A callback function that is called when the UI method fails to execute, with the first parameter type being {code: number, data: any}, which contains the error code and error message returned by the UI method.

  • If no fail callback function is provided, a red screen error will be generated when the UI method fails to execute.

Return Value

Contains the SelectorQuery object for this task. Call exec() to execute the task.

Examples

var params = {
  method: 'seekTo',
  params: {
    duration: 1000,
  },
  success: function (res) {
    console.log(res);
  },
  fail: function (data) {
    console.log(data.code, data.data);
  },
};

lynx.createSelectorQuery().select('#video').invoke(params).exec();

Compatibility

LCD tables only load in the browser

Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.