@foxglove/extension 2.45.0 → 2.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/experimental.ts +7 -3
- package/src/index.ts +2 -2
- package/src/stable.ts +19 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foxglove/extension",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.46.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Foxglove Technologies",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"prepack": "tsc -b tsconfig.json"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@foxglove/tsconfig": "3.
|
|
18
|
+
"@foxglove/tsconfig": "3.2.0",
|
|
19
19
|
"typescript": "5.9.3"
|
|
20
20
|
}
|
|
21
21
|
}
|
package/src/experimental.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
|
-
import type { Immutable } from "./immutable";
|
|
2
|
+
import type { Immutable } from "./immutable.ts";
|
|
3
3
|
import type {
|
|
4
4
|
ExtensionContext as BaseExtensionContext,
|
|
5
5
|
MessageEvent,
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
SettingsTreeFields,
|
|
9
9
|
SettingsTreeNode,
|
|
10
10
|
Topic,
|
|
11
|
-
} from "./stable";
|
|
11
|
+
} from "./stable.ts";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The experimental namespace contains experimental APIs that are not yet stable and WILL change or
|
|
@@ -210,11 +210,15 @@ export namespace Experimental {
|
|
|
210
210
|
/**
|
|
211
211
|
* This function will be called when your extension is loaded. In this function, you can register
|
|
212
212
|
* your custom panels or other types of extension features.
|
|
213
|
+
*
|
|
214
|
+
* The function may return a Promise if async initialization is needed before registering
|
|
215
|
+
* extension features. The extension will not be considered fully activated until the Promise
|
|
216
|
+
* resolves.
|
|
213
217
|
*/
|
|
214
218
|
activate: ExtensionActivate;
|
|
215
219
|
}
|
|
216
220
|
|
|
217
|
-
export type ExtensionActivate = (extensionContext: ExtensionContext) => void
|
|
221
|
+
export type ExtensionActivate = (extensionContext: ExtensionContext) => void | Promise<void>;
|
|
218
222
|
|
|
219
223
|
/**
|
|
220
224
|
* A button in the panel toolbar.
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from "./stable";
|
|
2
|
-
export type { Immutable } from "./immutable";
|
|
3
|
-
export type { Experimental } from "./experimental";
|
|
2
|
+
export type { Immutable } from "./immutable.ts";
|
|
3
|
+
export type { Experimental } from "./experimental.ts";
|
package/src/stable.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Immutable } from "./immutable";
|
|
1
|
+
import type { Immutable } from "./immutable.ts";
|
|
2
2
|
|
|
3
3
|
/** Valid types for parameter data (such as rosparams) */
|
|
4
4
|
export type ParameterValue =
|
|
@@ -1214,7 +1214,7 @@ export interface ExtensionContext {
|
|
|
1214
1214
|
* @inline
|
|
1215
1215
|
* @hidden
|
|
1216
1216
|
*/
|
|
1217
|
-
export type ExtensionActivate = (extensionContext: ExtensionContext) => void
|
|
1217
|
+
export type ExtensionActivate = (extensionContext: ExtensionContext) => void | Promise<void>;
|
|
1218
1218
|
|
|
1219
1219
|
/**
|
|
1220
1220
|
* ExtensionModule describes the interface your extension module must export. This typically corresponds to your `index.ts` file.
|
|
@@ -1234,12 +1234,29 @@ export type ExtensionActivate = (extensionContext: ExtensionContext) => void;
|
|
|
1234
1234
|
* export default { activate };
|
|
1235
1235
|
* ```
|
|
1236
1236
|
*
|
|
1237
|
+
* The `activate` function can also return a Promise to perform async initialization before
|
|
1238
|
+
* registering panels or converters:
|
|
1239
|
+
*
|
|
1240
|
+
* ```typescript
|
|
1241
|
+
* export async function activate(context: ExtensionContext) {
|
|
1242
|
+
* // Initialize WASM or other async resources
|
|
1243
|
+
* await initializeWasm();
|
|
1244
|
+
*
|
|
1245
|
+
* // Now register panels/converters that depend on the initialized resources
|
|
1246
|
+
* context.registerPanel({ ... });
|
|
1247
|
+
* }
|
|
1248
|
+
* ```
|
|
1249
|
+
*
|
|
1237
1250
|
* @category Entry point
|
|
1238
1251
|
*/
|
|
1239
1252
|
export interface ExtensionModule {
|
|
1240
1253
|
/**
|
|
1241
1254
|
* This function will be called when your extension is loaded. In this function, you can register
|
|
1242
1255
|
* your custom panels or other types of extension features.
|
|
1256
|
+
*
|
|
1257
|
+
* The function may return a Promise if async initialization is needed before registering
|
|
1258
|
+
* extension features. The extension will not be considered fully activated until the Promise
|
|
1259
|
+
* resolves.
|
|
1243
1260
|
*/
|
|
1244
1261
|
activate: ExtensionActivate;
|
|
1245
1262
|
}
|