HumanBreak/docs/api/class/resource-controller.md
2024-03-01 19:52:30 +08:00

1.1 KiB
Raw Blame History

抽象类 ReousrceController

渲染进程类,游戏进程不能直接使用,继承自 EventEmitter

list

declare var list: Record<string, any>
  • 成员说明

    存储了每个资源的信息,键为资源的 uri值为资源的数据

abstract add()

declare function add(uri: string, data: any): void
  • 参数说明

    • uri: 资源的唯一标识符Unique Resource Identifier
    • data: 资源数据
  • 方法说明

    添加一个资源

remove()

declare function remove(uri: string): void
  • 方法说明

    根据 uri 删除一个资源

add 事件

interface ResourceControllerEvent {
    add: (uri: string, data: D) => void
}

remove 事件

interface ResourceControllerEvent {
    delete: (uri: string, content: T) => void
}