JSFiddle - React, Tailwind, and code Playground
by Ronny
JavaScript
window.addEvent('gaready', function(){
//console.log('we add events before ga is ready', ga);
});
/* Custom gaready event - no need to check if ga is ready. Use it like you use domready */
var ga = {'isReady': true};
Element.Events.gaready = {
onAdd: function(fn){
// Like domready, if the event is added after already fired the function will run immediately
if(window.retrieve('gareadyfired')){
fn.call(this);
}
}
};
window.fireEvent('gaready').store('gareadyfired', true);
window.addEvent('gaready', function(){
//console.log('hi', ga);
});
var Greeter = new Class({
initialize: function(){
this.greet = 'hello there';
},
hi: function(){
console.log('hi');
},
welcome: function(name){
console.log(this, this.greet, name);
}
});
var greeter = new Greeter();
greeter.welcome('John');
window.addEvent('gaready', function(){
greeter.welcome('Doug');
});