UNPKG

@realsee/five

Version:

Realsee Renderer SDK

23 lines (22 loc) • 1.09 kB
import { Five } from "@realsee/five"; /** * 获取插件实例(非 hook,可在任意位置调用) */ export declare function getPlugin<T = any>(workCode: string, pluginName: string): T | undefined; /** * 手动设置插件实例到缓存(非 hook,可在任意位置调用) */ export declare function setPlugin(workCode: string, pluginName: string, plugin: any): void; export interface UseFivePluginOptions<T> { /** 缓存未命中时自动创建插件实例 */ createPlugin?: (five: Five) => T; /** Five 实例变化时是否重新创建(而非同步引用),默认 false */ reCreateOnFiveChange?: boolean; } export interface UseFivePluginOptionsWithCreate<T> extends UseFivePluginOptions<T> { createPlugin: (five: Five) => T; } /** 传了 createPlugin 时保证返回 T */ export declare function useFivePlugin<T>(pluginName: string, options: UseFivePluginOptionsWithCreate<T>): T; /** 未传 createPlugin 时返回 T | undefined */ export declare function useFivePlugin<T = any>(pluginName: string, options?: UseFivePluginOptions<T>): T | undefined;