Class: MainIpcStore#
Hierarchy#
- IpcStore
↳ MainIpcStore
Index#
Constructors#
Properties#
Methods#
Constructors#
constructor#
+ new MainIpcStore(extension: LensMainExtension): MainIpcStore
Overrides void
Defined in src/extensions/main-ipc-store.ts:26
Parameters:
| Name | Type |
|---|---|
extension |
LensMainExtension |
Returns: MainIpcStore
Properties#
[IpcPrefix]#
• [IpcPrefix]: string
Inherited from MainIpcStore.[IpcPrefix]
Defined in src/extensions/ipc-store.ts:29
Protected extension#
• extension: LensExtension
Inherited from MainIpcStore.extension
Defined in src/extensions/ipc-store.ts:31
Methods#
broadcastIpc#
▸ broadcastIpc(channel: string, ...args: any[]): void
Inherited from MainIpcStore.broadcastIpc
Defined in src/extensions/ipc-store.ts:36
Parameters:
| Name | Type |
|---|---|
channel |
string |
...args |
any[] |
Returns: void
handleIpc#
▸ handleIpc(channel: string, handler: function): void
Defined in src/extensions/main-ipc-store.ts:32
Parameters:
▪ channel: string
▪ handler: function
▸ (event: IpcMainInvokeEvent, ...args: any[]): any
Parameters:
| Name | Type |
|---|---|
event |
IpcMainInvokeEvent |
...args |
any[] |
Returns: void
listenIpc#
▸ listenIpc(channel: string, listener: function): void
Defined in src/extensions/main-ipc-store.ts:39
Parameters:
▪ channel: string
▪ listener: function
▸ (event: IpcMainEvent, ...args: any[]): any
Parameters:
| Name | Type |
|---|---|
event |
IpcMainEvent |
...args |
any[] |
Returns: void
Static createInstance#
▸ createInstance‹T, R›(this: StaticThis‹T, R›, ...args: R): T
Inherited from ExtensionStore.createInstance
Defined in src/common/utils/singleton.ts:46
Creates the single instance of the child class if one was not already created.
Multiple calls will return the same instance. Essentially throwing away the arguments to the subsequent calls.
Note: this is a racy function, if two (or more) calls are racing to call this function only the first's arguments will be used.
Type parameters:
▪ T
▪ R: any[]
Parameters:
| Name | Type | Description |
|---|---|---|
this |
StaticThis‹T, R› | Implicit argument that is the child class type |
...args |
R | The constructor arguments for the child class |
Returns: T
An instance of the child class
Static getInstance#
▸ getInstance‹T, R›(this: StaticThis‹T, R›, strict: boolean): T | undefined
Inherited from ExtensionStore.getInstance
Defined in src/common/utils/singleton.ts:67
Get the instance of the child class that was previously created.
Type parameters:
▪ T
▪ R: any[]
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
this |
StaticThis‹T, R› | - | Implicit argument that is the child class type |
strict |
boolean | true | If false will return undefined instead of throwing when an instance doesn't exist. Default: true |
Returns: T | undefined
An instance of the child class
Static resetInstance#
▸ resetInstance(): void
Inherited from ExtensionStore.resetInstance
Defined in src/common/utils/singleton.ts:82
Delete the instance of the child class.
Note: this doesn't prevent callers of getInstance from storing the result in a global.
There is no way in JS or TS to prevent globals like that.
Returns: void