@netless/appliance-plugin 1.0.2 → 1.0.3

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.
package/README.md CHANGED
@@ -11,8 +11,8 @@ A whiteboard pencil drawing plugin based on SpriteJS as a rendering engine.
11
11
  The following two demos are implemented in the example folder for reference only.
12
12
  | scenario | demo path | depends on |
13
13
  | :-- | :----: | :-- |
14
- | multi-window | example/src/multi.ts | @netless/window-manager, white-web-sdk |
15
- | white-board | example/src/single.ts | white-web-sdk |
14
+ | multi-window | [example/src/multi.ts](https://github.com/hqer927/appliance-plugin/blob/master/example/src/multi.ts) | @netless/window-managerwhite-web-sdk |
15
+ | white-board | [example/src/single.ts](https://github.com/hqer927/appliance-plugin/blob/master/example/src/single.ts) | white-web-sdk |
16
16
  <!-- | fastboard | todo | todo | -->
17
17
 
18
18
  ## Principle
@@ -71,7 +71,7 @@ const room = await whiteWebSdk.joinRoom({
71
71
  invisiblePlugins: [WindowManager, ApplianceMultiPlugin],
72
72
  useMultiViews: true,
73
73
  })
74
- const manager = await WindowManager.mount({ room , container:elm, chessboard: true, cursor: true, supportTeachingAidsPlugin: true});
74
+ const manager = await WindowManager.mount({ room , container:elm, chessboard: true, cursor: true, supportAppliancePlugin: true});
75
75
  if (manager) {
76
76
  await manager.switchMainViewToWriter();
77
77
  await ApplianceMultiPlugin.getInstance(manager,
@@ -134,8 +134,29 @@ module: {
134
134
  },
135
135
  ```
136
136
 
137
- ### Call introduction
138
- The plug-in re-implements some interfaces of the same name on room or window or manager. If you do not use the interface on the plug-in, you will not get the desired effect. But we can use injectMethodToObject to re-inject it back into the original object to get the plugin's intended effect. As follows:
137
+ ## Call introduction
138
+ ### api introduction
139
+ The plugin re-implements some of the interfaces of the same name on room or Windows Manager, but internally we have re-injected them back into the original object via injectMethodToObject. No changes are required for external users. As follows:
140
+ ```js
141
+ // Internal hack
142
+ injectMethodToObject(windowmanager, 'undo');
143
+ injectMethodToObject(windowmanager, 'redo');
144
+ injectMethodToObject(windowmanager,'cleanCurrentScene');
145
+ injectMethodToObject(windowmanager,'insertImage');
146
+ injectMethodToObject(windowmanager,'completeImageUpload');
147
+ injectMethodToObject(windowmanager,'lockImage');
148
+ injectMethodToObject(room,'getImagesInformation');
149
+ injectMethodToObject(room,'callbacks');
150
+ injectMethodToObject(room,'screenshotToCanvasAsync');
151
+ injectMethodToObject(room,'getBoundingRectAsync');
152
+ injectMethodToObject(room,'scenePreviewAsync');
153
+ injectMethodToObject(windowmanager.mainView,'setMemberState');
154
+ // These we can see the call behavior through the front-end log, for example:
155
+ // [ApplianceMultiPlugin] setMemberState
156
+ // [ApplianceMultiPlugin] cleanCurrentScene
157
+ ```
158
+ The following interfaces are involved:
159
+
139
160
  1. Interface on room
140
161
  - `setMemberState`
141
162
  - `undo`
@@ -166,3 +187,29 @@ The plug-in re-implements some interfaces of the same name on room or window or
166
187
  - `screenshotToCanvasAsync`
167
188
  - `scenePreviewAsync`
168
189
  - `destroy`
190
+
191
+ ### Configure parameters
192
+ ``getInstance(wm: WindowManager, adaptor: ApplianceAdaptor)``
193
+ - wm: WindowManager\room\player. In multi-window mode, you pass WindowManager, and in single-window mode, you pass room or player(whiteboard playback mode).
194
+ - adaptor: configures the adapter.
195
+ - options: ``AppliancePluginOptions``; The cdn addresses of both workers must be configured.
196
+ ```js
197
+ export type AppliancePluginOptions = {
198
+ /** cdn Configuration item */
199
+ cdn: CdnOpt;
200
+ /** Synchronize data configuration items */
201
+ syncOpt? : SyncOpt;
202
+ /** Canvas configuration item */
203
+ canvasOpt? : CanvasOpt;
204
+ }
205
+ ```
206
+ - cursorAdapter? : ``CursorAdapter``; This parameter is optional. In single whiteboard mode, customize the mouse style.
207
+
208
+ ### Front-end debugging introduction
209
+ During the interconnection process, if you want to understand and track the internal status of the plug-in, you can view the internal data through the following console commands.
210
+
211
+ ```js
212
+ const applianPlugin = await ApplianceSinglePlugin.getInstance(...)
213
+ applianPlugin.CurrentManager // can see the package version number, internal state, etc
214
+ applianPlugin.CurrentManager.ConsoleWorkerInfo () // can check information to draw on the worker
215
+ ```
package/cdn/cdn.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r="/fullWorker-6Cu08P.js",e="/subWorker-B3CHpe.js";exports.fullWorkerUrl=r;exports.subWorkerUrl=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r="/fullWorker-uIttd_.js",e="/subWorker-4wkCzC.js";exports.fullWorkerUrl=r;exports.subWorkerUrl=e;