@dimensional-innovations/electron-background 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AutoStart.d.ts +6 -6
- package/dist/AutoStart.js +6 -6
- package/package.json +1 -1
package/dist/AutoStart.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { BrowserWindowInitContext, InitPlugin } from './init';
|
|
1
|
+
import { BrowserWindowInitContext, NonBrowserWindowInitContext, InitPlugin } from './init';
|
|
2
2
|
export interface AutoStartOptions {
|
|
3
3
|
/** Delay in seconds before initialization on boot launches (0 = no delay). Default: 30 */
|
|
4
4
|
startupDelay?: number;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Registers the application as a login item for automatic startup and optionally
|
|
8
|
-
* delays
|
|
9
|
-
*
|
|
10
|
-
* when the app was auto-started at system
|
|
11
|
-
* process argument on Windows).
|
|
8
|
+
* delays window creation on boot. The delay runs in `afterReady` — before the
|
|
9
|
+
* BrowserWindow is created — giving the GPU and display time to initialize after
|
|
10
|
+
* a system reboot. The delay only applies when the app was auto-started at system
|
|
11
|
+
* boot (detected via the `--autostart` process argument on Windows).
|
|
12
12
|
*
|
|
13
13
|
* On macOS/Linux, boot detection is not reliably possible, so the delay is always
|
|
14
14
|
* skipped — the app launches instantly regardless of how it was started.
|
|
@@ -23,6 +23,6 @@ export declare class AutoStart implements InitPlugin {
|
|
|
23
23
|
constructor(enabled?: boolean, options?: AutoStartOptions);
|
|
24
24
|
/** Returns true when the app was launched by the OS login item (Windows only). */
|
|
25
25
|
private isAutoStartLaunch;
|
|
26
|
-
|
|
26
|
+
afterReady(context: NonBrowserWindowInitContext): Promise<void>;
|
|
27
27
|
afterLoad(context: BrowserWindowInitContext): Promise<void>;
|
|
28
28
|
}
|
package/dist/AutoStart.js
CHANGED
|
@@ -15,10 +15,10 @@ const electron_1 = require("electron");
|
|
|
15
15
|
const AUTOSTART_ARG = '--autostart';
|
|
16
16
|
/**
|
|
17
17
|
* Registers the application as a login item for automatic startup and optionally
|
|
18
|
-
* delays
|
|
19
|
-
*
|
|
20
|
-
* when the app was auto-started at system
|
|
21
|
-
* process argument on Windows).
|
|
18
|
+
* delays window creation on boot. The delay runs in `afterReady` — before the
|
|
19
|
+
* BrowserWindow is created — giving the GPU and display time to initialize after
|
|
20
|
+
* a system reboot. The delay only applies when the app was auto-started at system
|
|
21
|
+
* boot (detected via the `--autostart` process argument on Windows).
|
|
22
22
|
*
|
|
23
23
|
* On macOS/Linux, boot detection is not reliably possible, so the delay is always
|
|
24
24
|
* skipped — the app launches instantly regardless of how it was started.
|
|
@@ -37,12 +37,12 @@ class AutoStart {
|
|
|
37
37
|
isAutoStartLaunch() {
|
|
38
38
|
return process.platform === 'win32' && process.argv.includes(AUTOSTART_ARG);
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
afterReady(context) {
|
|
41
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
42
|
if (!this.enabled)
|
|
43
43
|
return;
|
|
44
44
|
if (this.startupDelay > 0 && this.isAutoStartLaunch()) {
|
|
45
|
-
context.log.info(`[AutoStart] Boot launch detected — delaying ${this.startupDelay}s before
|
|
45
|
+
context.log.info(`[AutoStart] Boot launch detected — delaying ${this.startupDelay}s before window creation`);
|
|
46
46
|
yield new Promise(resolve => setTimeout(resolve, this.startupDelay * 1000));
|
|
47
47
|
}
|
|
48
48
|
else if (this.startupDelay > 0) {
|