Last active
December 16, 2015 05:19
-
-
Save jpmckinney/5383575 to your computer and use it in GitHub Desktop.
Unexpected Yepnope callback order
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
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; | |
} | |
} | |
}); |
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
// @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); | |
} | |
} | |
}); |
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
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