refactor: application dependency management (#2363)
This commit is contained in:
14
packages/snjs/lib/Application/Dependencies/isDeinitable.ts
Normal file
14
packages/snjs/lib/Application/Dependencies/isDeinitable.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export function isDeinitable(service: unknown): service is { deinit(): void } {
|
||||
if (!service) {
|
||||
throw new Error('Service is undefined')
|
||||
}
|
||||
return typeof (service as { deinit(): void }).deinit === 'function'
|
||||
}
|
||||
|
||||
export function canBlockDeinit(service: unknown): service is { blockDeinit(): Promise<void> } {
|
||||
if (!service) {
|
||||
throw new Error('Service is undefined')
|
||||
}
|
||||
|
||||
return typeof (service as { blockDeinit(): Promise<void> }).blockDeinit === 'function'
|
||||
}
|
||||
Reference in New Issue
Block a user