-
-
Save bradenpowers/1207520 to your computer and use it in GitHub Desktop.
Monkey patch for require in Titanium Mobile
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
| //This shim layer will not be necessary in future Titanium versions, but | |
| //for now will serve to only load a required module once per context. | |
| var require_once; | |
| (function() { | |
| var scriptRegistry = {}; | |
| require_once = function(moduleName) { | |
| if (!scriptRegistry[moduleName]) { | |
| scriptRegistry[moduleName] = require(moduleName); | |
| } | |
| return scriptRegistry[moduleName]; | |
| }; | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment