diff --git a/lib/javascript-static.js b/lib/javascript-static.js index c00a0ef5cbc..df59cd7323e 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -667,34 +667,25 @@ M.util.js_pending = function(uniqid) { return M.util.pending_js.length; }; +// Start this asap. +M.util.js_pending('init'); + /** * Register listeners for Y.io start/end so we can wait for them in behat. */ -M.util.js_watch_io = function() { - YUI.add('moodle-core-io', function(Y) { - Y.on('io:start', function(id) { - M.util.js_pending('io:' + id); - }); - Y.on('io:end', function(id) { - M.util.js_complete('io:' + id); - }); +YUI.add('moodle-core-io', function(Y) { + Y.on('io:start', function(id) { + M.util.js_pending('io:' + id); }); - YUI.applyConfig({ - modules: { - 'moodle-core-io': { - after: ['io-base'] - }, - 'io-base': { - requires: ['moodle-core-io'], - } - } + Y.on('io:end', function(id) { + M.util.js_complete('io:' + id); }); - -}; - -// Start this asap. -M.util.js_pending('init'); -M.util.js_watch_io(); +}, '@VERSION@', { + condition: { + trigger: 'io-base', + when: 'after' + } +}); /** * Unregister any long running javascript code by unique identifier.