-
-
Save twhite96/741d44cfe07dafc149c6f4a2ff6ddcdd to your computer and use it in GitHub Desktop.
This file contains 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