Skip to content

Instantly share code, notes, and snippets.

@jpmckinney
Last active December 16, 2015 05:19
Show Gist options
  • Save jpmckinney/5383575 to your computer and use it in GitHub Desktop.
Save jpmckinney/5383575 to your computer and use it in GitHub Desktop.
Unexpected Yepnope callback order
console.log('bar.js is run (should run 2nd)');
yepnope({
load: 'https://gist.github.com/jpmckinney/5383575/raw/7e4ee538dd6059eea12e207652cf48f1de819364/foo.js',
callback: function () {
console.log('callback in bar.js is run (should run 4th)');
},
complete: function () {
console.log('complete in bar.js is run (should run 5th)');
window.divide = function (a, b) {
return a / b;
}
}
});
// @see http://jsfiddle.net/GJZQz/6/
console.log('fiddle.js is run (should run 1st)');
yepnope({
load: 'https://gist.github.com/jpmckinney/5383575/raw/fe00741908a0fe96755be31c5844b90edd04aac8/bar.js',
callback: function () {
console.log('callback in fiddle.js is run (should run 6th)');
},
complete: function () {
console.log('complete in fiddle.js is run (should run 7th)');
try {
divide(times(4, 6), 3);
}
catch (error) {
console.log(error);
}
}
});
console.log('foo.js is run (should run 3rd)');
window.times = function (a, b) {
return a * b;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment