Ver Fonte

Added events appload, appstart and appstop.

tschw há 10 anos atrás
pai
commit
97740cc710
1 ficheiros alterados com 9 adições e 2 exclusões
  1. 9 2
      editor/js/libs/app.js

+ 9 - 2
editor/js/libs/app.js

@@ -33,6 +33,9 @@ var APP = {
 			this.setCamera( loader.parse( json.camera ) );
 
 			events = {
+				appload: [],
+				appstart: [],
+				appstop: [],
 				keydown: [],
 				keyup: [],
 				mousedown: [],
@@ -75,6 +78,8 @@ var APP = {
 
 			}
 
+			dispatch( events.appload, arguments );
+
 		};
 
 		this.setCamera = function ( value ) {
@@ -186,9 +191,10 @@ var APP = {
 			document.addEventListener( 'touchend', onDocumentTouchEnd );
 			document.addEventListener( 'touchmove', onDocumentTouchMove );
 
+			dispatch( events.appstart, arguments );
+
 			request = requestAnimationFrame( animate );
 			prevTime = performance.now();
-
 		};
 
 		this.stop = function () {
@@ -202,8 +208,9 @@ var APP = {
 			document.removeEventListener( 'touchend', onDocumentTouchEnd );
 			document.removeEventListener( 'touchmove', onDocumentTouchMove );
 
-			cancelAnimationFrame( request );
+			dispatch( events.appstop, arguments );
 
+			cancelAnimationFrame( request );
 		};
 
 		//