@netless/appliance-plugin 1.1.5 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,6 +21,7 @@ export interface BaseApplianceManagerProps {
21
21
  /** 插件管理器 */
22
22
  export declare abstract class BaseApplianceManager {
23
23
  static InternalMsgEmitter: EventEmitter2;
24
+ static PublicMsgEmitter: EventEmitter2;
24
25
  readonly version: string;
25
26
  plugin?: AppliancePluginLike;
26
27
  readonly room?: Room;
@@ -8,6 +8,7 @@ import type { AppViewDisplayerManager, MainViewDisplayerManager } from "./baseVi
8
8
  import type { ApplianceSinglePlugin } from "./applianceSinglePlugin";
9
9
  import type { ApplianceMultiPlugin } from "./applianceMultiPlugin";
10
10
  import type { ECanvasContextType } from "../core/enum";
11
+ import { AuthRenderScenesData } from "../core/renderCotrol";
11
12
  export type { Room, ImageInformation, Point, Size, Rectangle, RoomMember, RoomState, Player, HotKeys, Camera, Displayer, DisplayerCallbacks, CameraState, View, Cursor, CursorAdapter, RenderEngine, _MemberState };
12
13
  export declare enum ApplianceNames {
13
14
  /**
@@ -119,13 +120,14 @@ export type ApplianceViewManagerLike = AppViewDisplayerManager | MainViewDisplay
119
120
  export interface BaseSubWorkModuleProps {
120
121
  control: ApplianceManagerLike;
121
122
  internalMsgEmitter: EventEmitter2;
123
+ publicMsgEmitter: EventEmitter2;
122
124
  }
123
125
  export type ApplianceAdaptor = {
124
126
  options: AppliancePluginOptions;
125
127
  logger?: Logger;
126
128
  cursorAdapter?: CursorAdapter;
127
129
  };
128
- export type canBindMethodType = keyof Omit<AppliancePluginInstance, 'displayer' | 'windowManager' | 'injectMethodToObject' | 'callbacksOn' | 'callbacksOnce' | 'callbacksOff' | '_injectTargetObject' | 'createMiniMap' | 'destroyMiniMap' | 'filterRenderByUid' | 'cancelFilterRender'>;
130
+ export type canBindMethodType = keyof Omit<AppliancePluginInstance, 'displayer' | 'windowManager' | 'injectMethodToObject' | 'callbacksOn' | 'callbacksOnce' | 'callbacksOff' | '_injectTargetObject' | 'createMiniMap' | 'destroyMiniMap' | 'filterRenderByUid' | 'cancelFilterRender' | 'addListener' | 'removeListener'>;
129
131
  export interface AppliancePluginInstance {
130
132
  readonly displayer: Displayer;
131
133
  readonly currentManager?: ApplianceManagerLike;
@@ -222,6 +224,14 @@ export interface AppliancePluginInstance {
222
224
  * @param isSync 是否同步到其他用户, 默认为true, 即会同步到其他用户,保持和filterRenderByUid设置的一致
223
225
  */
224
226
  cancelFilterRender(viewId: string, isSync?: boolean): void;
227
+ /**
228
+ * 添加事件监听器
229
+ */
230
+ addListener(event: PublicEvent, callback: PublicCallback<PublicEvent>): void;
231
+ /**
232
+ * 移除事件监听器
233
+ */
234
+ removeListener(event: PublicEvent, callback: PublicCallback<PublicEvent>): void;
225
235
  }
226
236
  export type Logger = {
227
237
  readonly info: (...messages: any[]) => void;
@@ -386,3 +396,18 @@ export type _ObjectTrue = true | {
386
396
  [key: Uid]: true;
387
397
  };
388
398
  export type _ArrayTrue = true | Uid[];
399
+ /**
400
+ * 公开的监听器类型
401
+ */
402
+ export type PublicListener = {
403
+ /** 同步页面分屏权限 */
404
+ syncPageAuth: (viewId: string, syncData: AuthRenderScenesData) => void;
405
+ /** 同步用户显示权限 */
406
+ syncRenderUids: (viewId: string, syncData: {
407
+ render?: _SetTrue;
408
+ hide?: _SetTrue;
409
+ clear?: _SetTrue;
410
+ }) => void;
411
+ };
412
+ export type PublicEvent = keyof PublicListener;
413
+ export type PublicCallback<T extends PublicEvent> = PublicListener[T];