code: function whenReady(fn, scope){
      if (domIsReady) {
          fn.call(scope);
          return;
      }
      domReadyQueue.push(function(){
          fn.call(scope);
      });
  }
docs: This will add a function to the queue of functions to be run once the DOM reaches a ready state.
  If functions are added after this event then they will be executed immediately.
  @param {function} fn The function to add
  @param {Object} scope An optional scope for the function to be called with.