@netless/appliance-plugin 1.0.0-beta.0 → 1.0.0-beta.2
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 +37 -15
- package/cdn/cdn.js +1 -0
- package/cdn/fullWorker-O4uzWn.js +566 -0
- package/cdn/subWorker-CvBoLi.js +566 -0
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +5850 -5867
- package/dist/cdn.d.ts +3 -0
- package/dist/core/mainEngine.d.ts +2 -0
- package/dist/fullWorker.js +566 -0
- package/dist/plugin/applianceMultiPlugin.d.ts +1 -1
- package/dist/plugin/applianceSinglePlugin.d.ts +1 -1
- package/dist/plugin/baseApplianceManager.d.ts +2 -2
- package/dist/plugin/index.d.ts +2 -3
- package/dist/plugin/types.d.ts +8 -1
- package/dist/subWorker.js +566 -0
- package/package.json +10 -15
- package/cdn/appliance-plugin.js +0 -1
- package/cdn/appliance-plugin.mjs +0 -8639
- package/cdn/style.css +0 -1
package/README.md
CHANGED
|
@@ -33,25 +33,18 @@ npm install @netless/appliance-plugin
|
|
|
33
33
|
Plug-ins can support two scenarios, their access plug-in names are different:
|
|
34
34
|
- Multi-window 'ApplianceMultiPlugin'
|
|
35
35
|
```js
|
|
36
|
-
// All bundled
|
|
37
36
|
import { ApplianceMultiPlugin } from '@netless/appliance-plugin';
|
|
38
|
-
// cdn
|
|
39
|
-
// import { ApplianceMultiPlugin } from '@netless/appliance-plugin/cdn';
|
|
40
37
|
```
|
|
41
38
|
- Single whiteboard 'ApplianceSinglePlugin'
|
|
42
39
|
```js
|
|
43
|
-
// All bundled
|
|
44
40
|
import { ApplianceSinglePlugin } from '@netless/appliance-plugin';
|
|
45
|
-
// cdn
|
|
46
|
-
// import { ApplianceSinglePlugin } from '@netless/appliance-plugin/cdn';
|
|
47
41
|
```
|
|
48
42
|
|
|
49
|
-
>
|
|
43
|
+
> workerjs file cdn deployment
|
|
50
44
|
>
|
|
51
|
-
>
|
|
45
|
+
> We used two-worker concurrency to improve drawing efficiency, which improved it by more than 40% over single-thread efficiency. However, the common dependencies on the two worker files are repeated, so building directly into the package will greatly increase the package size. So we allow the workerjs file cdn deployment by simply deploying the file under @netless/appliance-plugin/cdn into the cdn and then configuring the c of the last two workerjs via the second parameter of getInstance in the plug-in, options.cdn The dn address is fine. This solves the problem of excessive package size
|
|
52
46
|
>
|
|
53
|
-
> - **
|
|
54
|
-
> - The cdn version reduces the size of the package, but there are network problems, please fully consider it
|
|
47
|
+
> - **The total package is about 300kB, and the two wokerjs are 600kB each** If you need to consider the size of the package you are building, select Configure cdn.
|
|
55
48
|
|
|
56
49
|
### Access mode reference
|
|
57
50
|
|
|
@@ -64,7 +57,13 @@ import { WindowManager } from "@netless/window-manager";
|
|
|
64
57
|
// All bundled
|
|
65
58
|
import { ApplianceMultiPlugin } from '@netless/appliance-plugin';
|
|
66
59
|
// cdn
|
|
67
|
-
//
|
|
60
|
+
// The following steps are optional. If you use a cdn, you don't need to import it from dist
|
|
61
|
+
import fullWorkerString from '@netless/appliance-plugin/dist/fullWorker.js?raw';
|
|
62
|
+
import subWorkerString from '@netless/appliance-plugin/dist/subWorker.js?raw';
|
|
63
|
+
const fullWorkerBlob = new Blob([fullWorkerString], {type: 'text/javascript'});
|
|
64
|
+
const fullWorkerUrl = URL.createObjectURL(fullWorkerBlob);
|
|
65
|
+
const subWorkerBlob = new Blob([subWorkerString], {type: 'text/javascript'});
|
|
66
|
+
const subWorkerUrl = URL.createObjectURL(subWorkerBlob);
|
|
68
67
|
|
|
69
68
|
const whiteWebSdk = new WhiteWebSdk(...)
|
|
70
69
|
const room = await whiteWebSdk.joinRoom({
|
|
@@ -75,7 +74,16 @@ useMultiViews: true,
|
|
|
75
74
|
const manager = await WindowManager.mount({ room , container:elm, chessboard: true, cursor: true, supportTeachingAidsPlugin: true});
|
|
76
75
|
if (manager) {
|
|
77
76
|
await manager.switchMainViewToWriter();
|
|
78
|
-
await ApplianceMultiPlugin.getInstance(manager
|
|
77
|
+
await ApplianceMultiPlugin.getInstance(manager,
|
|
78
|
+
{
|
|
79
|
+
options: {
|
|
80
|
+
cdn: {
|
|
81
|
+
fullWorkerUrl,
|
|
82
|
+
subWorkerUrl,
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
);
|
|
79
87
|
}
|
|
80
88
|
```
|
|
81
89
|
#### Single whiteboard (interconnection with white-web-sdk)
|
|
@@ -83,8 +91,13 @@ await ApplianceMultiPlugin.getInstance(manager);
|
|
|
83
91
|
import { WhiteWebSdk } from "white-web-sdk";
|
|
84
92
|
// All bundled
|
|
85
93
|
import { ApplianceSinglePlugin, ApplianceSigleWrapper } from '@netless/appliance-plugin';
|
|
86
|
-
// cdn
|
|
87
|
-
|
|
94
|
+
// The following steps are optional. If you use a cdn, you don't need to import it from dist
|
|
95
|
+
import fullWorkerString from '@netless/appliance-plugin/dist/fullWorker.js?raw';
|
|
96
|
+
import subWorkerString from '@netless/appliance-plugin/dist/subWorker.js?raw';
|
|
97
|
+
const fullWorkerBlob = new Blob([fullWorkerString], {type: 'text/javascript'});
|
|
98
|
+
const fullWorkerUrl = URL.createObjectURL(fullWorkerBlob);
|
|
99
|
+
const subWorkerBlob = new Blob([subWorkerString], {type: 'text/javascript'});
|
|
100
|
+
const subWorkerUrl = URL.createObjectURL(subWorkerBlob);
|
|
88
101
|
|
|
89
102
|
const whiteWebSdk = new WhiteWebSdk(...)
|
|
90
103
|
const room = await whiteWebSdk.joinRoom({
|
|
@@ -92,7 +105,16 @@ const room = await whiteWebSdk.joinRoom({
|
|
|
92
105
|
invisiblePlugins: [ApplianceSinglePlugin],
|
|
93
106
|
wrappedComponents: [ApplianceSigleWrapper]
|
|
94
107
|
})
|
|
95
|
-
await ApplianceSinglePlugin.getInstance(room
|
|
108
|
+
await ApplianceSinglePlugin.getInstance(room,
|
|
109
|
+
{
|
|
110
|
+
options: {
|
|
111
|
+
cdn: {
|
|
112
|
+
fullWorkerUrl,
|
|
113
|
+
subWorkerUrl,
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
);
|
|
96
118
|
```
|
|
97
119
|
|
|
98
120
|
### Call introduction
|
package/cdn/cdn.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r="/fullWorker-O4uzWn.js",e="/subWorker-CvBoLi.js";exports.fullWorkerUrl=r;exports.subWorkerUrl=e;
|