lynx: registerModule() static method

获取一个可以在当前 LynxView 中共享使用的 JavaScript 对象。

语法

registerModule: <Module>(name: string, module: Module) => void;

参数

name

需要注册的对象名。

module

需要注册的对象。

返回值

无(undefined)。

示例

在 JS 中获取共享对象

Use the [lynx.getJSModule] method to get a registered module:

const fooModule = {};
lynx.registerModule('foo', fooModule);
lynx.getJSModule('foo') === fooModule; // true

兼容性

LCD tables only load in the browser

除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。