For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /reference/sdk/module-loader/classes/ModuleRegistry.md.
  • 简体中文
  • Class: ModuleRegistry

    Defined in: module-loader/runtime.ts:118

    模块注册表:冷启动生命周期与 shutdown cleanup。

    Constructors

    Constructor

    new ModuleRegistry(): ModuleRegistry;

    Returns

    ModuleRegistry

    Methods

    register()

    static register(descriptor: ModuleDescriptor): void;

    Defined in: module-loader/runtime.ts:120

    注册模块描述符(构建时各模块包调用)。

    Parameters

    ParameterType
    descriptorModuleDescriptor

    Returns

    void


    list()

    static list(): ModuleDescriptor[];

    Defined in: module-loader/runtime.ts:126

    返回已注册模块列表副本。

    Returns

    ModuleDescriptor[]


    get()

    static get(id: string): ModuleDescriptor | undefined;

    Defined in: module-loader/runtime.ts:131

    按 id 查找模块描述符。

    Parameters

    ParameterType
    idstring

    Returns

    ModuleDescriptor | undefined


    isActive()

    static isActive(id: string): boolean;

    Defined in: module-loader/runtime.ts:136

    模块是否处于启用且可启动状态(启动时 ConfigManager 缓存)。

    Parameters

    ParameterType
    idstring

    Returns

    boolean


    bootAll()

    static bootAll(): Promise<void>;

    Defined in: module-loader/runtime.ts:141

    启动所有已启用且尚未 boot 的模块(串行等待以防多模块并发 init 状态污染)。

    Returns

    Promise<void>


    bootAfterWorldLoad()

    static bootAfterWorldLoad(): Promise<void>;

    Defined in: module-loader/runtime.ts:150

    世界加载后:对已 boot 且未 init 的 afterWorldLoad 模块执行 init。

    Returns

    Promise<void>


    bootModule()

    static bootModule(id: string): Promise<void>;

    Defined in: module-loader/runtime.ts:163

    启动单个模块(权限/事件;init 按 afterWorldLoad 分相)。

    Parameters

    ParameterType
    idstring

    Returns

    Promise<void>


    initModule()

    static initModule(id: string): Promise<void>;

    Defined in: module-loader/runtime.ts:190

    执行单个模块的 init 生命周期(串行等待异步就绪并标记 initialized)。

    Parameters

    ParameterType
    idstring

    Returns

    Promise<void>


    cleanupModule()

    static cleanupModule(id: string): void;

    Defined in: module-loader/runtime.ts:207

    清理单个模块(lifecycle.cleanup + 身份上下文)。

    Parameters

    ParameterType
    idstring

    Returns

    void


    teardown()

    static teardown(): void;

    Defined in: module-loader/runtime.ts:221

    清理全部已注册模块(shutdown 时调用)。

    Returns

    void


    isBooted()

    static isBooted(id: string): boolean;

    Defined in: module-loader/runtime.ts:230

    模块是否已完成 register* 阶段。

    Parameters

    ParameterType
    idstring

    Returns

    boolean


    isWorldLoaded()

    static isWorldLoaded(): boolean;

    Defined in: module-loader/runtime.ts:235

    宿主是否已走过 worldLoad 分相(bootAfterWorldLoad 已调用)。

    Returns

    boolean


    getBootPhase()

    static getBootPhase(): {
      startup: boolean;
      worldLoad: boolean;
      summary: string;
    };

    Defined in: module-loader/runtime.ts:243

    boot 分相只读快照(沙箱「已装载」清单用)。 startup = ConfigManager 已就绪;worldLoad = 已执行 bootAfterWorldLoad。

    Returns

    {
      startup: boolean;
      worldLoad: boolean;
      summary: string;
    }
    NameTypeDefined in
    startupbooleanmodule-loader/runtime.ts:243
    worldLoadbooleanmodule-loader/runtime.ts:243
    summarystringmodule-loader/runtime.ts:243

    resetForTesting()

    static resetForTesting(): void;

    Defined in: module-loader/runtime.ts:255

    测试沙箱复位注册表(勿在 BDS 生产路径调用)。

    Returns

    void