Skip to content

Commit 8b84ec5

Browse files
committed
Check if library is already loaded
1 parent 56a4b99 commit 8b84ec5

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

dist/plugins/iwsy.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,16 @@ const EasyCoder_IWSY = {
178178
switch (action) {
179179
case `init`:
180180
const cdn = program.getValue(command.cdn);
181-
program.require(`js`, `${cdn}/iwsy.js`,
182-
function () {
183-
program.run(command.pc + 1);
184-
});
185-
return 0;
181+
if (typeof IWSY === `undefined`) {
182+
program.require(`js`, `${cdn}/iwsy.js`,
183+
function () {
184+
program.run(command.pc + 1);
185+
});
186+
return 0;
187+
} else {
188+
program.run(command.pc + 1);
189+
}
190+
break;
186191
case `load`:
187192
const playerRecord = program.getSymbolRecord(command.player);
188193
const player = playerRecord.element[playerRecord.index];

js/plugins/iwsy.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,16 @@ const EasyCoder_IWSY = {
178178
switch (action) {
179179
case `init`:
180180
const cdn = program.getValue(command.cdn);
181-
program.require(`js`, `${cdn}/iwsy.js`,
182-
function () {
183-
program.run(command.pc + 1);
184-
});
185-
return 0;
181+
if (typeof IWSY === `undefined`) {
182+
program.require(`js`, `${cdn}/iwsy.js`,
183+
function () {
184+
program.run(command.pc + 1);
185+
});
186+
return 0;
187+
} else {
188+
program.run(command.pc + 1);
189+
}
190+
break;
186191
case `load`:
187192
const playerRecord = program.getSymbolRecord(command.player);
188193
const player = playerRecord.element[playerRecord.index];

0 commit comments

Comments
 (0)