mount WindowManager
const manager = await WindowManager. mount(
room: room,
container: document. getElementById("container")
// full configuration see below
);
parameter
name | type | default | desc |
---|---|---|---|
room | [require] Room | room instance | |
container | [require] HTMLElement | room mount container | |
containerSizeRatio | [optional] number | 9 / 16 | The aspect ratio of the multi-window area, the default is 9 : 16 |
chessboard | [optional] boolean | true | The space outside the multi-window area displays PS checkerboard background, default true |
collectorContainer | [optional] HTMLElement | dom for multi-window minimize icon mount | |
collectorStyles | [optional] Partial{CSSStyleDeclaration} | Configure collector style | |
overwriteStyles | [optional] string | The style to use for the overlay window | |
cursor | [optional] boolean | false | Turn on cursor sync |
disableCameraTransform | [optional] boolean | Disable camera movement for the main whiteboard | |
prefersColorScheme | [optional] string | light | auto, light, dark |
debug | [optional] boolean | false | print log information |
applianceIcons | [optional] {ApplianceNames, string} | Configure the teaching aid picture used by the cursor |
Register
APP
toWindowManager
WindowManager. register({
kind: "hello World",
src: NetlessApp,
appOptions: () => "appOptions",
addHooks: (emitter) => {
emitter.on("created", result => {
console.log("HelloWordResult", result);
});
emitter.on("focus", result => {
console.log("HelloWorld focus", result);
})
emitter.on("destroy", result => {
console.log("HelloWorld destroy", result);
})
}
})
Get the registered
App
WindowManager.registered
Set whiteboard mount container
WindowManager.setContainer(document.getElementById("container"));
Set container mounted by
Collector
WindowManager.setCollectorContainer(document.getElementById("collector-container"));
add
app
to whiteboard
const appId = await manager.addApp({
kind: "hello World"
options: { // optional configuration
scenePath: "/hello-world"
}
})
For specific parameters, please refer to the requirements of APP
itself
Close any open
APP
manager.closeApp(appId)
Switch the
app
of the currentfocus
, and set thisapp
to the front
manager.focusApp(appId)
Set the
SceneIndex
of the main whiteboard
manager.setMainViewSceneIndex(1)
Set the current
boxState
manager.setBoxState("normal") // boxState: normal | maximized | minimized
Clear the handwriting of the currently focused view
manager.cleanCurrentScene()
Redo the last operation on the currently focused view
manager.redo()
Undo the last action on the currently focused view
manager.undo()
Switch main whiteboard to next page
const success = await manager.nextPage()
if (!success) {
// reached the last page
}
Switch main whiteboard to previous page
const success = await manager.prevPage()
if (!success) {
// have reached the first page
}
Add a page to the main whiteboard
manager.addPage() // add a page at the end by default
manager.addPage({ after: true }) // add a page after the current page
manager.addPage({ scene: { name: "page2" } }) // pass in page information
remove a page When there is only one page left, the last page is not allowed to be deleted
const success = await manager.removePage() // delete the current page by default
const success = await manager.removePage(1) // can delete the specified index
Refreshes
manager
internal state forcopy
attributes
from other rooms
manager.refresh()
Set the aspect ratio of the whiteboard synchronization area
manager.setContainerSizeRatio(10 / 16)
name | type | default | desc |
---|---|---|---|
mainView | View | main whiteboard | |
mainViewSceneIndex | number | The SceneIndex of the current main whiteboard | |
mainViewScenesLength | number | mainView's scenes length | |
boxState | string | current window status | |
darkMode | boolean | dark mode | |
prefersColorScheme | string | color theme | |
focused | string | focus app | |
canRedoSteps | number | The number of steps that the currently focused view can redo | |
canRedoSteps | number | The number of steps that the currently focused view can undo | |
sceneState | SceneState | Compatible with the sceneState property of the original SDK, only valid for mainView | |
pageState | PageState | Combine the index and scenes modification of mainView |
manager.emitter.on(events, listener)
name | type | default | desc |
---|---|---|---|
mainViewModeChange | ViewVisionMode | ||
mainViewSceneIndexChange | index: number | ||
boxStateChange | string | normal,minimized,maximized | |
darkModeChange | boolean | ||
prefersColorSchemeChange | string | auto,light,dark | |
cameraStateChange | CameraState | ||
focusedChange | string, undefined | The appId of the current focus, undefined for the main whiteboard | |
mainViewScenesLengthChange | number | fires when mainView scenes are added or removed | |
canRedoStepsChange | number | The view of the current focus can redo the number of steps to change | |
canUndoStepsChange | number | The current focus view can undo the step change | |
loadApp | LoadAppEvent | Load remote APP event | |
ready | undefined | Triggered when all apps are created | |
sceneStateChange | SceneState | Fired when sceneState is modified | |
pageStateChange | PageState | ||
fullscreenChange | boolean | Triggered when the full-screen status changes | | |
appsChange | string[] | Triggered when the list of opened apps changes |
type LoadAppEvent = {
kind: string;
status: "start" | "success" | "failed";
reason?: string;
}
type PageState = {
index: number;
length: number;
}