Created
October 18, 2014 17:20
-
-
Save bcardarella/cf5c14311af42e38d932 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
requirejs.rollback = function() { | |
for(var entry in this.previousEntries) { | |
if (this.previousEntries[entry]) { | |
registry[entry] = this.previousEntries[entry]; | |
} else { | |
delete registry[entry]; | |
} | |
} | |
}; | |
requirejs.define = function(entry, deps, callback) { | |
if (this.previousEntries[entry]) { | |
throw 'cannot define twice'; | |
} else { | |
this.previousEntries[entry] = registry[entry]; | |
registry[entry] = { deps: deps, callback: callback }; | |
} | |
}; | |
module('validator class lookup order', { | |
setup: function() { | |
requirejs.previousEntries = {}; | |
}, | |
teardown: function() { | |
requirejs.rollback(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment