Skip to content

Commit

Permalink
Make registration works for multiple map instances
Browse files Browse the repository at this point in the history
  • Loading branch information
sebstryczek committed Dec 10, 2024
1 parent 8fcff10 commit ede8248
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/telemetry/registerTelemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ maptilersdk.Map.prototype.telemetry = {
};
/* *** */

let isRegistered = false;
const registeredMaps: Array<number> = [];

function registerTelemetry(map: maptilersdk.Map) {
if (isRegistered === true) {
if (registeredMaps.includes(map._mapId)) {
return;
}

map.telemetry.registerModule(packagejson.name, packagejson.version);

isRegistered = true;
registeredMaps.push(map._mapId);
}

export { registerTelemetry };

0 comments on commit ede8248

Please sign in to comment.