Sha256: 701ec0425ca8e424daa3395d420c1dead2bc0b8ad8ee24cdb6b8445dc05f0185
Contents?: true
Size: 1.29 KB
Versions: 24
Compression:
Stored size: 1.29 KB
Contents
//>>excludeStart("exclude", pragmas.exclude); define([ "shoestring" ], function(){ //>>excludeEnd("exclude"); /** * Bind callbacks to be run when the DOM is "ready". * * @param {function} fn The callback to be run * @return shoestring * @this shoestring */ shoestring.ready = function( fn ){ if( ready && fn ){ fn.call( doc ); } else if( fn ){ readyQueue.push( fn ); } else { runReady(); } return [doc]; }; // TODO necessary? shoestring.fn.ready = function( fn ){ shoestring.ready( fn ); return this; }; // Empty and exec the ready queue var ready = false, readyQueue = [], runReady = function(){ if( !ready ){ while( readyQueue.length ){ readyQueue.shift().call( doc ); } ready = true; } }; // If DOM is already ready at exec time, depends on the browser. // From: https://github.com/mobify/mobifyjs/blob/526841be5509e28fc949038021799e4223479f8d/src/capture.js#L128 if (doc.attachEvent ? doc.readyState === "complete" : doc.readyState !== "loading") { runReady(); } else { doc.addEventListener( "DOMContentLoaded", runReady, false ); doc.addEventListener( "readystatechange", runReady, false ); win.addEventListener( "load", runReady, false ); } //>>excludeStart("exclude", pragmas.exclude); }); //>>excludeEnd("exclude");
Version data entries
24 entries across 24 versions & 1 rubygems