api/window: add .closed
This commit is contained in:
parent
fe715333b5
commit
38127dd4bc
5
gluon.d.ts
vendored
5
gluon.d.ts
vendored
@ -339,7 +339,10 @@ type Window = {
|
||||
controls: ControlsApi,
|
||||
|
||||
/** Close the Gluon window. */
|
||||
close(): void
|
||||
close(): void,
|
||||
|
||||
/** If the window has been closed or not. */
|
||||
closed: Boolean
|
||||
};
|
||||
|
||||
|
||||
|
@ -134,12 +134,17 @@ export default async (CDP, proc, injectionType = 'browser', { dataPath, browserN
|
||||
},
|
||||
|
||||
close: () => {
|
||||
if (Window.closed) return false;
|
||||
|
||||
for (const handler of closeHandlers) handler(); // extra api handlers which need to be closed
|
||||
|
||||
CDP.sendMessage('Browser.close');
|
||||
CDP.close();
|
||||
proc.kill();
|
||||
|
||||
return Window.closed = true;
|
||||
},
|
||||
closed: false,
|
||||
|
||||
versions
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user