External: window

window

The built in window Object
Source:
window.js, line 11
See:

Methods

onReady(fn)

Specify a function to execute when the DOM is fully loaded
Parameters:
Name Type Description
fn function A function to execute after the DOM is ready.
Source:
window.js, line 117
Example
// small main skeleton
var game = {
   // Initialize the game
   // called by the window.onReady function
   onload : function () {
      // init video
      if (!me.video.init('screen', 640, 480, true)) {
         alert("Sorry but your browser does not support html 5 canvas.");
         return;
      }

      // initialize the "audio"
      me.audio.init("mp3,ogg");

      // set callback for ressources loaded event
      me.loader.onload = this.loaded.bind(this);

      // set all ressources to be loaded
      me.loader.preload(game.resources);

      // load everything & display a loading screen
      me.state.change(me.state.LOADING);
   },

   // callback when everything is loaded
   loaded : function () {
      // define stuff
      // ....

      // change to the menu screen
      me.state.change(me.state.MENU);
   }
}; // game

// "bootstrap"
window.onReady(function () {
   game.onload();
});
Copyright © 2011 - 2017, Olivier Biot, Jason Oster, Aaron McLeod
Documentation generated by JSDoc 3.4.0 on 2017-02-28T11:37:40+08:00 using the DocStrap template modified by codename-.