From 8b84ec5279a567d679dc2ba79e2c8917e28c70d5 Mon Sep 17 00:00:00 2001 From: Graham Trott Date: Mon, 20 Jul 2020 12:45:04 +0100 Subject: [PATCH] Check if library is already loaded --- dist/plugins/iwsy.js | 15 ++++++++++----- js/plugins/iwsy.js | 15 ++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/dist/plugins/iwsy.js b/dist/plugins/iwsy.js index 766655f..9112099 100644 --- a/dist/plugins/iwsy.js +++ b/dist/plugins/iwsy.js @@ -178,11 +178,16 @@ const EasyCoder_IWSY = { switch (action) { case `init`: const cdn = program.getValue(command.cdn); - program.require(`js`, `${cdn}/iwsy.js`, - function () { - program.run(command.pc + 1); - }); - return 0; + if (typeof IWSY === `undefined`) { + program.require(`js`, `${cdn}/iwsy.js`, + function () { + program.run(command.pc + 1); + }); + return 0; + } else { + program.run(command.pc + 1); + } + break; case `load`: const playerRecord = program.getSymbolRecord(command.player); const player = playerRecord.element[playerRecord.index]; diff --git a/js/plugins/iwsy.js b/js/plugins/iwsy.js index 766655f..9112099 100644 --- a/js/plugins/iwsy.js +++ b/js/plugins/iwsy.js @@ -178,11 +178,16 @@ const EasyCoder_IWSY = { switch (action) { case `init`: const cdn = program.getValue(command.cdn); - program.require(`js`, `${cdn}/iwsy.js`, - function () { - program.run(command.pc + 1); - }); - return 0; + if (typeof IWSY === `undefined`) { + program.require(`js`, `${cdn}/iwsy.js`, + function () { + program.run(command.pc + 1); + }); + return 0; + } else { + program.run(command.pc + 1); + } + break; case `load`: const playerRecord = program.getSymbolRecord(command.player); const player = playerRecord.element[playerRecord.index];