vendor/assets/javascripts/almond.js in requirejs-rails-0.9.1 vs vendor/assets/javascripts/almond.js in requirejs-rails-0.9.2

- old
+ new

@@ -1,7 +1,7 @@ /** - * almond 0.2.3 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved. + * almond 0.2.5 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/jrburke/almond for details */ //Going sloppy to avoid 'use strict' string cost, but strict practices should //be followed. @@ -355,13 +355,19 @@ //Simulate async callback; if (forceSync) { main(undef, deps, callback, relName); } else { + //Using a non-zero value because of concern for what old browsers + //do, and latest browsers "upgrade" to 4 if lower value is used: + //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout: + //If want a value immediately, use require('id') instead -- something + //that works in almond on the global level, but not guaranteed and + //unlikely to work in other AMD implementations. setTimeout(function () { main(undef, deps, callback, relName); - }, 15); + }, 4); } return req; }; @@ -369,10 +375,13 @@ * Just drops the config on the floor, but returns req in case * the config return value is used. */ req.config = function (cfg) { config = cfg; + if (config.deps) { + req(config.deps, config.callback); + } return req; }; define = function (name, deps, callback) { @@ -391,6 +400,6 @@ }; define.amd = { jQuery: true }; -}()); +}()); \ No newline at end of file