ExtensionModule
ExtensionModule describes the interface your extension module must export. This typically corresponds to your index.ts file.
You may use either a default export or named export syntax:
export function activate(context: ExtensionContext) {
// ... call methods on the extensionContext to extend Foxglove
}
function activate(context: ExtensionContext) {
// ... call methods on the extensionContext to extend Foxglove
}
export default { activate };
The activate function can also return a Promise to perform async initialization before
registering panels or converters:
export async function activate(context: ExtensionContext) {
// Initialize WASM or other async resources
await initializeWasm();
// Now register panels/converters that depend on the initialized resources
context.registerPanel({ ... });
}
Properties
activate()
activate: (extensionContext) => void | Promise<void>;
This function will be called when your extension is loaded. In this function, you can register your custom panels or other types of extension features.
The function may return a Promise if async initialization is needed before registering extension features. The extension will not be considered fully activated until the Promise resolves.
Parameters
| Parameter | Type |
|---|---|
extensionContext | ExtensionContext |
Returns
void | Promise<void>