diff --git a/index.html b/index.html
index 406203f5..4642c347 100644
--- a/index.html
+++ b/index.html
@@ -140,10 +140,10 @@
],
],
// key: "-----",
- onEvent: (event, ci) => {
- console.log("Event", event)
+ onEvent: (event, arg) => {
+ console.log("Event", event, arg);
if (event === "ci-ready") {
- window.ci = ci;
+ window.ci = arg;
// props.setFrame("network");
// props.setFullScreen(true);
}
diff --git a/package.json b/package.json
index 643ee559..9fedb420 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "js-dos",
- "version": "8.3.10",
+ "version": "8.3.11",
"description": "Full-featured DOS player with multiple emulator backends",
"type": "module",
"keywords": [
diff --git a/src/host/fullscreen.ts b/src/host/fullscreen.ts
index 77b52478..1b0c2338 100644
--- a/src/host/fullscreen.ts
+++ b/src/host/fullscreen.ts
@@ -1,8 +1,9 @@
-import { Store, getNonSerializableStore } from "../store";
+import { Store, getNonSerializableStore, postJsDosEvent } from "../store";
import { uiSlice } from "../store/ui";
export function browserSetFullScreen(fullScreen: boolean, store: Store) {
- const root = getNonSerializableStore(store).root as any;
+ const nsStore = getNonSerializableStore(store);
+ const root = nsStore.root as any;
if (fullScreen) {
if (root.requestFullscreen) {
root.requestFullscreen();
@@ -32,4 +33,5 @@ export function browserSetFullScreen(fullScreen: boolean, store: Store) {
}
store.dispatch(uiSlice.actions.setFullScreen(fullScreen));
+ postJsDosEvent(nsStore, "fullscreen-change", fullScreen);
}
diff --git a/src/public/types.ts b/src/public/types.ts
index 795c3ec2..5c873da6 100644
--- a/src/public/types.ts
+++ b/src/public/types.ts
@@ -1,4 +1,4 @@
-export type DosEvent = "emu-ready" | "ci-ready" | "bnd-play" | "open-key";
+export type DosEvent = "emu-ready" | "ci-ready" | "bnd-play" | "open-key" | "fullscreen-change";
export type ImageRendering = "pixelated" | "smooth";
export type RenderBackend = "webgl" | "canvas";
export type RenderAspect = "AsIs" | "1/1" | "5/4" | "4/3" | "16/10" | "16/9" | "Fit";
@@ -35,7 +35,7 @@ export interface DosOptions {
backendHardware: ((backend: "dosbox" | "dosboxX", sockdriveNative: boolean) => Promise),
workerThread: boolean,
mouseCapture: boolean,
- onEvent: (event: DosEvent, ci?: any /* CommandInterface */) => void,
+ onEvent: (event: DosEvent, arg?: any /* CommandInterface | boolean */) => void,
ipx: NamedHost[],
ipxBackend: string,
room: string,
diff --git a/src/store.ts b/src/store.ts
index 22e18b5f..784550d1 100644
--- a/src/store.ts
+++ b/src/store.ts
@@ -111,10 +111,11 @@ export function useNonSerializableStore() {
return getNonSerializableStore(useStore());
}
-export function postJsDosEvent(nonSerializableStore: NonSerializableStore, event: DosEvent, ci?: CommandInterface) {
+export function postJsDosEvent(nonSerializableStore: NonSerializableStore, event: DosEvent,
+ arg?: CommandInterface | boolean) {
if (nonSerializableStore.options.onEvent) {
setTimeout(() => {
- nonSerializableStore.options.onEvent?.(event, ci);
+ nonSerializableStore.options.onEvent?.(event, arg);
}, 4);
}
}