Skip to content

Class: ExtensionStore ‹T›#

Type parameters#

▪ T

Hierarchy#

  • BaseStore‹T›

↳ ExtensionStore

Index#

Constructors#

Properties#

Accessors#

Methods#

Constructors#

Protected constructor#

+ new ExtensionStore(params: BaseStoreParams): ExtensionStore

Inherited from ExtensionStore.constructor

Overrides Singleton.constructor

Defined in src/common/base-store.ts:49

Parameters:

Name Type
params BaseStoreParams

Returns: ExtensionStore

Properties#

Protected extension#

• extension: LensExtension

Defined in src/extensions/extension-store.ts:27


isLoaded#

• isLoaded: boolean = false

Inherited from ExtensionStore.isLoaded

Defined in src/common/base-store.ts:45


Protected params#

• params: BaseStoreParams

Inherited from ExtensionStore.params

Defined in src/common/base-store.ts:51


Protected Optional storeConfig#

• storeConfig? : Config‹T›

Inherited from ExtensionStore.storeConfig

Defined in src/common/base-store.ts:42


Protected syncDisposers#

• syncDisposers: Disposer[] = []

Inherited from ExtensionStore.syncDisposers

Defined in src/common/base-store.ts:43

Accessors#

name#

• get name(): string

Inherited from ExtensionStore.name

Defined in src/common/base-store.ts:63

Returns: string


path#

• get path(): string

Inherited from ExtensionStore.path

Defined in src/common/base-store.ts:75

Returns: string


Protected syncMainChannel#

• get syncMainChannel(): string

Inherited from ExtensionStore.syncMainChannel

Defined in src/common/base-store.ts:71

Returns: string


Protected syncRendererChannel#

• get syncRendererChannel(): string

Inherited from ExtensionStore.syncRendererChannel

Defined in src/common/base-store.ts:67

Returns: string


whenLoaded#

• get whenLoaded(): Promise‹void› & object

Inherited from ExtensionStore.whenLoaded

Defined in src/common/base-store.ts:47

Returns: Promise‹void› & object

Methods#

Protected applyWithoutSync#

▸ applyWithoutSync(callback: function): void

Inherited from ExtensionStore.applyWithoutSync

Defined in src/common/base-store.ts:165

Parameters:

▪ callback: function

▸ (): void

Returns: void


Protected cwd#

▸ cwd(): string

Overrides void

Defined in src/extensions/extension-store.ts:41

Returns: string


disableSync#

▸ disableSync(): void

Inherited from ExtensionStore.disableSync

Defined in src/common/base-store.ts:160

Returns: void


enableSync#

▸ enableSync(): void

Inherited from ExtensionStore.enableSync

Defined in src/common/base-store.ts:119

Returns: void


Protected Abstract fromStore#

▸ fromStore(data: T): void

Inherited from ExtensionStore.fromStore

Defined in src/common/base-store.ts:195

fromStore is called internally when a child class syncs with the file system.

Parameters:

Name Type Description
data T the parsed information read from the stored JSON file

Returns: void


Protected init#

▸ init(): Promise‹void›

Inherited from ExtensionStore.init

Defined in src/common/base-store.ts:79

Returns: Promise‹void›


load#

▸ load(): Promise‹void›

Overrides void

Defined in src/extensions/extension-store.ts:35

Returns: Promise‹void›


loadExtension#

▸ loadExtension(extension: LensExtension): Promise‹void›

Defined in src/extensions/extension-store.ts:29

Parameters:

Name Type
extension LensExtension

Returns: Promise‹void›


Protected onModelChange#

▸ onModelChange(model: T): Promise‹void›

Inherited from ExtensionStore.onModelChange

Defined in src/common/base-store.ts:181

Parameters:

Name Type
model T

Returns: Promise‹void›


Protected onSync#

▸ onSync(model: T): void

Inherited from ExtensionStore.onSync

Defined in src/common/base-store.ts:174

Parameters:

Name Type
model T

Returns: void


Protected onSyncFromMain#

▸ onSyncFromMain(model: T): void

Inherited from ExtensionStore.onSyncFromMain

Defined in src/common/base-store.ts:149

Parameters:

Name Type
model T

Returns: void


Protected saveToFile#

▸ saveToFile(model: T): Promise‹void›

Inherited from ExtensionStore.saveToFile

Defined in src/common/base-store.ts:108

Parameters:

Name Type
model T

Returns: Promise‹void›


Abstract toJSON#

▸ toJSON(): T

Inherited from ExtensionStore.toJSON

Defined in src/common/base-store.ts:204

toJSON is called when syncing the store to the filesystem. It should produce a JSON serializable object representation of the current state.

It is recommended that a round trip is valid. Namely, calling this.fromStore(this.toJSON()) shouldn't change the state.

Returns: T


unregisterIpcListener#

▸ unregisterIpcListener(): void

Inherited from ExtensionStore.unregisterIpcListener

Defined in src/common/base-store.ts:155

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