1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Rename ExtensionStore -> BaseExtensionStore

- The name was too close to ExtensionsStore

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2023-01-24 09:50:51 -05:00
parent 4b1d740d61
commit 42fd7839fa
2 changed files with 6 additions and 6 deletions

View File

@ -26,14 +26,14 @@ export interface ExtensionStoreParams<T extends object> extends BaseStoreParams<
migrations?: Migrations<T>;
}
export abstract class ExtensionStore<T extends object> extends BaseStore<T> {
export abstract class BaseExtensionStore<T extends object> extends BaseStore<T> {
private static readonly instances = new WeakMap<object, any>();
/**
* @deprecated This is a form of global shared state. Just call `new Store(...)`
*/
static createInstance<T, R extends any[]>(this: StaticThis<T, R>, ...args: R): T {
return getOrInsertWith(ExtensionStore.instances, this, () => new this(...args)) as T;
return getOrInsertWith(BaseExtensionStore.instances, this, () => new this(...args)) as T;
}
/**
@ -42,11 +42,11 @@ export abstract class ExtensionStore<T extends object> extends BaseStore<T> {
static getInstance<T, R extends any[]>(this: StaticThis<T, R>, strict?: true): T;
static getInstance<T, R extends any[]>(this: StaticThis<T, R>, strict: false): T | undefined;
static getInstance<T, R extends any[]>(this: StaticThis<T, R>, strict = true): T | undefined {
if (!ExtensionStore.instances.has(this) && strict) {
if (!BaseExtensionStore.instances.has(this) && strict) {
throw new TypeError(`instance of ${this.name} is not created`);
}
return ExtensionStore.instances.get(this) as (T | undefined);
return BaseExtensionStore.instances.get(this) as (T | undefined);
}
constructor({ migrations, ...params }: ExtensionStoreParams<T>) {
@ -70,7 +70,7 @@ export abstract class ExtensionStore<T extends object> extends BaseStore<T> {
* @deprecated This is a form of global shared state. Just call `new Store(...)`
*/
static resetInstance() {
ExtensionStore.instances.delete(this);
BaseExtensionStore.instances.delete(this);
}
protected extension?: LensExtension;

View File

@ -4,7 +4,7 @@
*/
import type { BaseStoreParams } from "../../common/base-store/base-store";
import { ExtensionStore } from "../extension-store";
import { BaseExtensionStore as ExtensionStore } from "../base-extension-store";
export {
BaseStoreParams,