For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/lynx-api/lynx/lynx-register-module.md.
Lynx
  • 简体中文
  • 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 许可协议进行许可。