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

add removeProtocolHandlers to LensExtension

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2020-12-10 09:15:31 -05:00
parent 97c50e50e4
commit 9f77b060c8
2 changed files with 10 additions and 0 deletions

View File

@ -56,6 +56,12 @@ export class LensExtension {
lpr.extensionOn(this.id, pathSchema, handler);
}
removeProtocolHandlers(): void {
const lpr = LensProtocolRouter.getInstance<LensProtocolRouter>();
lpr.removeExtensionHandlers(this.id);
}
get description() {
return this.manifest.description;
}

View File

@ -186,6 +186,10 @@ export class LensProtocolRouter extends Singleton {
this.extentionRoutes.get(id).set(urlSchema, handler);
}
public removeExtensionHandlers(id: ExtensionId): void {
this.extentionRoutes.get(id)?.clear();
}
/**
* onMissingExtension registers the handler for when an extension is missing
* @param handler If the called handler resolves to true then the routes will be tried again