chore: implement removeApplication
This commit is contained in:
@@ -35,8 +35,19 @@ export abstract class WebOrDesktopDevice implements WebOrDesktopDeviceInterface
|
||||
|
||||
removeApplication(application: ApplicationInterface): void {
|
||||
const database = this.databaseForIdentifier(application.identifier)
|
||||
database.deinit()
|
||||
this.databases = this.databases.filter((db) => db !== database)
|
||||
|
||||
if (database) {
|
||||
database.deinit()
|
||||
this.databases = this.databases.filter((db) => db !== database)
|
||||
}
|
||||
}
|
||||
|
||||
deinit() {
|
||||
for (const database of this.databases) {
|
||||
database.deinit()
|
||||
}
|
||||
|
||||
this.databases = []
|
||||
}
|
||||
|
||||
public async getJsonParsedRawStorageValue(key: string): Promise<unknown | undefined> {
|
||||
@@ -66,14 +77,6 @@ export abstract class WebOrDesktopDevice implements WebOrDesktopDeviceInterface
|
||||
return { killsApplication: false }
|
||||
}
|
||||
|
||||
deinit() {
|
||||
for (const database of this.databases) {
|
||||
database.deinit()
|
||||
}
|
||||
|
||||
this.databases = []
|
||||
}
|
||||
|
||||
async getRawStorageValue(key: string): Promise<string | undefined> {
|
||||
const result = localStorage.getItem(key)
|
||||
|
||||
|
||||
@@ -152,6 +152,10 @@ export class WebApplication extends SNApplication implements WebApplicationInter
|
||||
override deinit(mode: DeinitMode, source: DeinitSource): void {
|
||||
super.deinit(mode, source)
|
||||
|
||||
if (!this.isNativeMobileWeb()) {
|
||||
this.webOrDesktopDevice().removeApplication(this)
|
||||
}
|
||||
|
||||
try {
|
||||
for (const service of Object.values(this.webServices)) {
|
||||
if (!service) {
|
||||
@@ -278,6 +282,10 @@ export class WebApplication extends SNApplication implements WebApplicationInter
|
||||
return this.deviceInterface as MobileDeviceInterface
|
||||
}
|
||||
|
||||
webOrDesktopDevice(): WebOrDesktopDevice {
|
||||
return this.deviceInterface as WebOrDesktopDevice
|
||||
}
|
||||
|
||||
public getThemeService() {
|
||||
return this.webServices.themeService
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user