@zturnlibs/ztron-api


single-instance

Variables

singleInstance

const singleInstance: object

Defined in: single-instance.ts:28

Type Declaration

isPrimary

isPrimary: () => Promise<boolean> = isPrimaryInstance

Whether this process is the primary (first-launched) instance.

Returns

Promise<boolean>

onSecondInstance

onSecondInstance: (handler) => Promise<() => Promise<void>>

Listens for a second instance attempting to launch. The handler runs on the primary instance with the second instance's argv/cwd — for a packed app, the args its launcher received (the launcher forwards them to the backend, the secondary POSTs them to the primary before exiting, like upstream).

Parameters
handler

(event) => void

Returns

Promise<() => Promise<void>>

Functions

isPrimaryInstance()

isPrimaryInstance(): Promise<boolean>

Defined in: single-instance.ts:9

Whether this process is the primary (first-launched) instance.

Returns

Promise<boolean>


onSecondInstance()

onSecondInstance(handler): Promise<() => Promise<void>>

Defined in: single-instance.ts:19

Listens for a second instance attempting to launch. The handler runs on the primary instance with the second instance's argv/cwd — for a packed app, the args its launcher received (the launcher forwards them to the backend, the secondary POSTs them to the primary before exiting, like upstream).

Parameters

handler

(event) => void

Returns

Promise<() => Promise<void>>