Skip to content

Commit

Permalink
fix undefined track_info data within "eledata_loaded" event (#253)
Browse files Browse the repository at this point in the history
Closes: #241
  • Loading branch information
Raruto authored May 16, 2023
1 parent b0006d6 commit 02bcbbb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,12 @@ export const Elevation = L.Control.Elevation = L.Control.extend({

this.import(this.__D3).then(() => {
this._initMapIntegrations(layer);
this._fireEvt("eledata_loaded", { data: geojson, layer: layer, name: this.track_info.name, track_info: this.track_info });
const event_data = { data: geojson, layer: layer, name: this.track_info.name, track_info: this.track_info };
if (this._modulesLoaded) {
this._fireEvt("eledata_loaded", event_data);
} else {
this.once('modules_loaded', () => this._fireEvt("eledata_loaded", event_data));
}
});

return layer;
Expand Down
1 change: 1 addition & 0 deletions test/setup/http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function suite() {
test.before(setup);
test.after(reset);
test.before.each(async ({ localhost, page }) => {
page.on('console', msg => console.log(msg.text()))
await page.goto((new URL(arguments[0], localhost)).toString());
});
// augment uvu `test` function with a third parameter `timeout`
Expand Down

0 comments on commit 02bcbbb

Please sign in to comment.