This commit is contained in:
Adam Bradley
2013-08-23 13:05:38 -05:00
parent d9f7577508
commit dedfe2dc69
5 changed files with 9840 additions and 18 deletions

View File

@ -1,22 +1,28 @@
(function(window, document, framework) {
framework.init = function() {
if(!framework._init) {
framework._init = true;
console.log("Framwork init!");
}
};
if ( document.readyState === "complete" ) {
setTimeout( framework.init, 1 );
} else {
if ( document.addEventListener ) {
document.addEventListener( "DOMContentLoaded", framework.init, false );
window.addEventListener( "load", framework.init, false );
} else if ( document.attachEvent ) {
document.attachEvent( "onreadystatechange", framework.init );
window.attachEvent( "onload", framework.init );
}
// Start initalizing the framework
function initalize() {
framework.trigger("initalized");
}
})(this, document, this.FW || {});
// DOM has completed
function completed() {
document.removeEventListener( "DOMContentLoaded", completed, false );
window.removeEventListener( "load", completed, false );
framework.trigger("ready");
initalize();
}
// When the DOM is ready, call .ready()
if ( document.readyState === "complete" ) {
// DOM is already ready, run .ready() via setTimeout
setTimeout( completed );
} else {
// DOM isn't ready yet, add event listeners for when it is
document.addEventListener( "DOMContentLoaded", completed, false );
window.addEventListener( "load", completed, false );
}
})(this, document, this.FM = this.FM || {});

View File

@ -0,0 +1,11 @@
(function(window, document, framework) {
framework.trigger = function(type, data) {
window.dispatchEvent( new CustomEvent(type, data) );
};
framework.on = function(type, callback) {
window.addEventListener(type, callback);
};
})(this, document, this.FM = this.FM || {});

View File

@ -0,0 +1,13 @@
(function(window, document, framework, $) {
framework.on("ready", function(){
console.log("ready")
});
// Test that the standard jQuery call works with our event system
$(window).on("initalized", function() {
console.log("initalized");
});
})(this, document, this.FM = this.FM || {}, jQuery);

9789
js/jquery/jquery-1.10.2.js vendored Normal file

File diff suppressed because it is too large Load Diff