From 9f77b060c88fc3df29897e96f775b31518e6e786 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 10 Dec 2020 09:15:31 -0500 Subject: [PATCH] add removeProtocolHandlers to LensExtension Signed-off-by: Sebastian Malton --- src/extensions/lens-extension.ts | 6 ++++++ src/main/protocol-handler/router.ts | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/extensions/lens-extension.ts b/src/extensions/lens-extension.ts index 4c9d948e16..ff8758c384 100644 --- a/src/extensions/lens-extension.ts +++ b/src/extensions/lens-extension.ts @@ -56,6 +56,12 @@ export class LensExtension { lpr.extensionOn(this.id, pathSchema, handler); } + removeProtocolHandlers(): void { + const lpr = LensProtocolRouter.getInstance(); + + lpr.removeExtensionHandlers(this.id); + } + get description() { return this.manifest.description; } diff --git a/src/main/protocol-handler/router.ts b/src/main/protocol-handler/router.ts index 2c09b58456..01732b08e0 100644 --- a/src/main/protocol-handler/router.ts +++ b/src/main/protocol-handler/router.ts @@ -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