Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/core/util/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,14 @@ export const IS_NODE = Object.prototype.toString.call(typeof process !== 'undefi

export function getGlobalThis() {
return typeof globalThis !== 'undefined' ? globalThis : global || self;
}

export function checkMTKVersion(version) {
const mtkversion = getGlobalThis().maptalksversion;
if (mtkversion) {
console.error('maptalks repeated import, which may result in duplicate packaging or the introduction of multiple maptalks umd versions');
console.error(`maptalks repeated import error. find version:'${mtkversion}',but Currently mounting version:'${version}'. This may lead to some unpredictable bugs`);
} else {
getGlobalThis().maptalksversion = version;
}
}
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,5 @@ const worker = {
};

export { worker };

Util.checkMTKVersion(version);