mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-11-15 07:07:07 +00:00
rename extension api event
This commit is contained in:
1 parent
57c34b388b
commit
59c9427778
1 file changed
+5
-2
@@ -85,7 +85,10 @@ function setGroup(
|
|||||||
export class ExtensionAPI {
|
export class ExtensionAPI {
|
||||||
/** The version of the API; the methods of v1 are still there, until extensions have moved. */
|
/** The version of the API; the methods of v1 are still there, until extensions have moved. */
|
||||||
readonly version = 2;
|
readonly version = 2;
|
||||||
/** Resolved once overlays can be set. `gpxstudio:ready` is sent on `window` at that moment. */
|
/**
|
||||||
|
* Resolved once overlays can be set. `gpxstudio:extension-api-ready` is sent on `window` at that
|
||||||
|
* moment.
|
||||||
|
*/
|
||||||
ready!: Promise<void>;
|
ready!: Promise<void>;
|
||||||
|
|
||||||
private _overlays: Writable<Map<string, RegisteredOverlay>> = writable(new Map());
|
private _overlays: Writable<Map<string, RegisteredOverlay>> = writable(new Map());
|
||||||
@@ -97,7 +100,7 @@ export class ExtensionAPI {
|
|||||||
init() {
|
init() {
|
||||||
if (browser && !Object.hasOwn(window, 'gpxstudio')) {
|
if (browser && !Object.hasOwn(window, 'gpxstudio')) {
|
||||||
this.ready = this.ensureLoaded();
|
this.ready = this.ensureLoaded();
|
||||||
this.ready.then(() => window.dispatchEvent(new Event('gpxstudio:ready')));
|
this.ready.then(() => window.dispatchEvent(new Event('gpxstudio:extension-api-ready')));
|
||||||
Object.defineProperty(window, 'gpxstudio', {
|
Object.defineProperty(window, 'gpxstudio', {
|
||||||
value: this,
|
value: this,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user