JSFiddle - React, Tailwind, and code Playground
JavaScript
var tryURL = 'http://development.traineasy.com/traineasy_cpd/menu/menu.js';
YUI().use('base', 'node', 'io', function(Y){
var io = Y.io;
function Bar () {
// var m = Y.io._map;
/*
Y.Do.before(function(url, cfg) {
Y.Do.before(function(id, e) {
Y.one('body').append('<p>before complete<p>');
}, cfg.on, 'complete', cfg.context);
}, Y, 'io');
*/
Y.Do.before(function(url, cfg) {
Y.one('body').append('<p>before complete<p>');
}, Y.IO.prototype, 'complete');
// Y.io._map = m;
};
var Foo = Y.Base.create('foo', Y.Base, [Bar], {
go: function() {
Y.io(tryURL, {
xdr : {
use : 'native'
},
method : "GET",
timeout : 20000,
on : {
complete : function(id,o) {
this.yikes();
},
failure : function(id,o) {
alert("could not load menu using YUI");
}
},
context: this
});
},
yikes: function() {
Y.one('body').append('<p>yikes!<p>');
}
});
var myFoo = new Foo();
myFoo.go();
});