Created
April 20, 2019 20:28
-
-
Save yoav-lavi/7ea123f8c76f43dd131eb96530294142 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Variables used by Scriptable. | |
// These must be at the very top of the file. Do not edit. | |
// icon-color: green; icon-glyph: file-code; | |
const getModule = importModule("getModule"); | |
const documentDirectory = FileManager.iCloud().documentsDirectory(); | |
module.exports = async ({ moduleName, url, forceDownload = false }) => { | |
if (moduleExists(moduleName) && !forceDownload) { | |
return importModule(moduleName); | |
} | |
return await getModule({ moduleName, url }); | |
} | |
const moduleExists = (moduleName) => FileManager.iCloud().fileExists(`${documentDirectory}/${moduleName}.js`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment