add removeProtocolHandlers to LensExtension

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

No files matched your search

+6
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;
}
+4
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