function onReady(fn) {
	// register on blur/focus and visibility event handlers
	if (typeof globalThis.addEventListener === "function") {
		// set pause/stop action on losing focus
		globalThis.addEventListener(
			"blur",
			() => {
				eventEmitter.emit(BLUR);
			},
			false,
		);
		// set restart/resume action on gaining focus
		globalThis.addEventListener(
			"focus",
			() => {
				eventEmitter.emit(FOCUS);
				// force focus if autofocus is on
				if (autoFocus === true) {
					focus();
				}
			},
			false,
		);
	}
	if (typeof globalThis.document !== "undefined") {
		if (typeof globalThis.document.addEventListener === "function") {
			// register on the visibilitychange event if supported
			globalThis.document.addEventListener(
				"visibilitychange",
				() => {
					if (globalThis.document.visibilityState === "visible") {
						eventEmitter.emit(FOCUS);
						// force focus if autofocus is on
						if (autoFocus === true) {
							focus();
						}
					} else {
						eventEmitter.emit(BLUR);
					}
				},
				false,
			);
		}
	}
	// call the supplied function
	DOMContentLoaded(fn);
}
specify a function to execute when the Device is fully loaded and ready
@memberof device
@param {Function} fn - the function to be executed
@example
// small game skeleton
let game = {
   // called by the me.device.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.assets);

      // 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.PLAY);
   }
}; // game

// "bootstrap"
me.device.onReady(function () {
   game.onload();
});