Skip to content

Commit 8653bc1

Browse files
committed
feat: surface changePage events
1 parent e8b3c79 commit 8653bc1

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

packages/companion-surface-base/src/surface-api/context.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ export interface SurfaceContext {
1717
rotateLeftById(controlId: string): void
1818
rotateRightById(controlId: string): void
1919

20+
changePage(forward: boolean): void
21+
2022
sendVariableValue(variable: string, value: any): void
2123
}

packages/companion-surface-host/src/context.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export interface HostSurfaceEvents {
2828
readonly inputPress: (surfaceId: string, controlId: string, pressed: boolean) => void
2929
readonly inputRotate: (surfaceId: string, controlId: string, delta: number) => void
3030

31+
readonly changePage: (surfaceId: string, forward: boolean) => void
32+
3133
readonly setVariableValue: (surfaceId: string, name: string, value: any) => void
3234

3335
readonly pincodeEntry: (surfaceId: string, char: number) => void

packages/companion-surface-host/src/surfaceProxy.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,12 @@ export class SurfaceProxyContext implements SurfaceContext {
442442
this.#host.surfaceEvents.inputRotate(this.#surfaceId, controlId, 1)
443443
}
444444

445+
changePage(forward: boolean): void {
446+
if (this.#isLocked) return
447+
448+
this.#host.surfaceEvents.changePage(this.#surfaceId, forward)
449+
}
450+
445451
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
446452
sendVariableValue(variable: string, value: any): void {
447453
if (this.#isLocked) return

0 commit comments

Comments
 (0)