From 253e30ab55e5b34a664665a2f1e7dd080a5b2ee7 Mon Sep 17 00:00:00 2001 From: CanadaHonk Date: Tue, 20 Dec 2022 21:32:32 +0000 Subject: [PATCH] typedef: add idle api --- gluon.d.ts | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/gluon.d.ts b/gluon.d.ts index 5807ed4..3a8c8e3 100644 --- a/gluon.d.ts +++ b/gluon.d.ts @@ -52,10 +52,49 @@ type CDPApi = { ): Promise }; +type IdleAutoOptions = { + /** + * How long the window should be minimized before hibernating, in seconds. + * @default 5 + */ + timeMinimizedToHibernate?: Number +}; + +type IdleApi = { + /** Put the window into hibernation. */ + hibernate(): void, + + /** Put the window to sleep. */ + sleep(): void, + + /** + * Wake up the window from hibernation or sleep. + * @todo Unimplemented (for Idle v2). + */ + wake(): void, + + /** Enable/disable automatic idle management, and set its options. */ + auto( + /** Whether to use automatic idle management. */ + enabled: bool, + + /** Set options for automatic behavior. */ + options?: IdleAutoOptions + ) +}; + type Window = { + /** API for accessing the window itself. */ window: WindowApi, + + /** API for IPC. */ ipc: IPCApi, - cdp: CDPApi + + /** API for manually using CDP with the browser. */ + cdp: CDPApi, + + /** API for Gluon idle management (like hibernation). */ + idle: IdleApi };