mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
extensions-api -- in-progress
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
a8ce263dc9
commit
e56f8f3362
8
src/extensions/example-extension/example-extension.ts
Normal file
8
src/extensions/example-extension/example-extension.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { LensExtension } from "@lens"; // todo: handle runtime import
|
||||||
|
|
||||||
|
export class ExampleExtension extends LensExtension {
|
||||||
|
async init(): Promise<any> {
|
||||||
|
console.log('Example extension: init')
|
||||||
|
return super.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "extension-example",
|
"name": "extension-example",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Example extension",
|
"description": "Example extension",
|
||||||
"main": "extension-example.ts",
|
"main": "example-extension.ts",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,9 +46,8 @@ export class ExtensionStore extends BaseStore<ExtensionStoreModel> {
|
|||||||
async removeById(id: ExtensionId) {
|
async removeById(id: ExtensionId) {
|
||||||
const extension = this.getById(id);
|
const extension = this.getById(id);
|
||||||
if (extension) {
|
if (extension) {
|
||||||
const unInstallStatus = await extension.uninstall()
|
await extension.uninstall();
|
||||||
this.extensions.delete(id);
|
this.extensions.delete(id);
|
||||||
return unInstallStatus;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,6 +29,10 @@ export class LensExtension implements ExtensionModel {
|
|||||||
this.isEnabled = enabled;
|
this.isEnabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async init(){
|
||||||
|
// todo?
|
||||||
|
}
|
||||||
|
|
||||||
async install() {
|
async install() {
|
||||||
// todo
|
// todo
|
||||||
}
|
}
|
||||||
|
|||||||
6
src/extensions/lens-app.d.ts
vendored
Normal file
6
src/extensions/lens-app.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
// todo: re-export / expose more apis
|
||||||
|
// todo: generate as Lens.d.js + add real runtime exports
|
||||||
|
|
||||||
|
declare module "@lens" {
|
||||||
|
export { LensExtension, ExtensionId, ExtensionVersion } from "./extension";
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user