diff --git a/dist/r3.js b/dist/r3.js index 65bdb0f..59d2d27 100644 --- a/dist/r3.js +++ b/dist/r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.784'; - static compileDate = '2021 Sep 19 - 21:28:13 pm'; + static version = '2.0.788'; + static compileDate = '2021 Sep 19 - 21:34:33 pm'; } class Runtime { @@ -955,9 +955,9 @@ class SystemDOM extends System { /** * OnDomComponentInitialized() - * - Listens to events of type Event.DOM_COMPONENT_INITIALIZED and executes this function. + * - Listens to events of type Event.DOM_COMPONENT_INITIALIZED and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnDomComponentInitialized(object) { @@ -1139,9 +1139,9 @@ class SystemInput extends System { /** * OnTouchStart() - * - Listens to events of type Event.TOUCH_START and executes this function. + * - Listens to events of type Event.TOUCH_START and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnTouchStart(object) { @@ -1149,9 +1149,9 @@ class SystemInput extends System { /** * OnTouchEnd() - * - Listens to events of type Event.TOUCH_END and executes this function. + * - Listens to events of type Event.TOUCH_END and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnTouchEnd(object) { @@ -1159,9 +1159,9 @@ class SystemInput extends System { /** * OnTouchMove() - * - Listens to events of type Event.TOUCH_MOVE and executes this function. + * - Listens to events of type Event.TOUCH_MOVE and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnTouchMove(object) { @@ -1169,9 +1169,9 @@ class SystemInput extends System { /** * OnTouchCancel() - * - Listens to events of type Event.TOUCH_CANCEL and executes this function. + * - Listens to events of type Event.TOUCH_CANCEL and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnTouchCancel(object) { @@ -1179,9 +1179,9 @@ class SystemInput extends System { /** * OnKeyboardDown() - * - Listens to events of type Event.KEYBOARD_DOWN and executes this function. + * - Listens to events of type Event.KEYBOARD_DOWN and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnKeyboardDown(object) { @@ -1189,9 +1189,9 @@ class SystemInput extends System { /** * OnKeyboardUp() - * - Listens to events of type Event.KEYBOARD_UP and executes this function. + * - Listens to events of type Event.KEYBOARD_UP and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnKeyboardUp(object) { @@ -1199,9 +1199,9 @@ class SystemInput extends System { /** * OnMouseDown() - * - Listens to events of type Event.MOUSE_DOWN and executes this function. + * - Listens to events of type Event.MOUSE_DOWN and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnMouseDown(object) { @@ -1209,9 +1209,9 @@ class SystemInput extends System { /** * OnMouseUp() - * - Listens to events of type Event.MOUSE_UP and executes this function. + * - Listens to events of type Event.MOUSE_UP and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnMouseUp(object) { @@ -1219,9 +1219,9 @@ class SystemInput extends System { /** * OnMouseMove() - * - Listens to events of type Event.MOUSE_MOVE and executes this function. + * - Listens to events of type Event.MOUSE_MOVE and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnMouseMove(object) { @@ -1229,9 +1229,9 @@ class SystemInput extends System { /** * OnMouseWheel() - * - Listens to events of type Event.MOUSE_WHEEL and executes this function. + * - Listens to events of type Event.MOUSE_WHEEL and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnMouseWheel(object) { @@ -1366,7 +1366,7 @@ class SystemLinking extends System { /** * OnObjectCreated() - * - Listens to events of type OBJECT_CREATED and executes this function. + * - Listens to events of type Event.OBJECT_CREATED and executes this function. * @param object (The event data passed as argument - typically an R3Object) * @return */ @@ -1378,7 +1378,7 @@ class SystemLinking extends System { /** * OnObjectInitialized() - * - Listens to events of type OBJECT_INITIALIZED and executes this function. + * - Listens to events of type Event.OBJECT_INITIALIZED and executes this function. * @param object (The event data passed as argument - typically an R3Object) * @return */ @@ -1390,7 +1390,7 @@ class SystemLinking extends System { /** * OnInstanceCreated() - * - Listens to events of type INSTANCE_CREATED and executes this function. + * - Listens to events of type Event.INSTANCE_CREATED and executes this function. * @param object (The event data passed as argument - typically an R3Object) * @return */ @@ -1402,7 +1402,7 @@ class SystemLinking extends System { /** * OnCreateInstanceBefore() - * - Listens to events of type CREATE_INSTANCE_BEFORE and executes this function. + * - Listens to events of type Event.CREATE_INSTANCE_BEFORE and executes this function. * @param object (The event data passed as argument - typically an R3Object) * @return boolean delayInstance which indicates whether or not instance creation is delayed (handled) by * another system. (i.e. where instance creation order is of importance) @@ -1528,9 +1528,9 @@ class SystemRender extends System { /** * OnInstanceCreated() - * - Listens to events of type Event.INSTANCE_CREATED and executes this function. + * - Listens to events of type Event.INSTANCE_CREATED and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnInstanceCreated(object) { @@ -1668,9 +1668,9 @@ class SystemRuntime extends System { /** * OnGetRuntime() - * - Listens to events of type Event.GET_RUNTIME and executes this function. + * - Listens to events of type Event.GET_RUNTIME and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnGetRuntime(object) { @@ -1696,9 +1696,9 @@ class SystemRuntime extends System { /** * OnProjectInitialized() - * - Listens to events of type Event.PROJECT_INITIALIZED and executes this function. + * - Listens to events of type Event.PROJECT_INITIALIZED and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnProjectInitialized(object) { @@ -1945,9 +1945,9 @@ class SystemStorage extends System { /** * OnImageComponentInitialized() - * - Listens to events of type Event.IMAGE_COMPONENT_INITIALIZED and executes this function. + * - Listens to events of type Event.IMAGE_COMPONENT_INITIALIZED and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnImageComponentInitialized(object) { @@ -2190,89 +2190,87 @@ class Event { } -Event.BEFORE_RENDER = 0x1; -Event.COMPONENT_CREATED = 0x2; -Event.COMPONENT_INITIALIZED = 0x3; -Event.CREATE_INSTANCE_BEFORE = 0x4; -Event.DISPOSE_INSTANCE = 0x5; -Event.DISPOSE_OBJECT = 0x6; -Event.DOM_COMPONENT_INITIALIZED = 0x7; -Event.ENTITY_CREATED = 0x8; -Event.ENTITY_INITIALIZED = 0x9; -Event.GET_RUNTIME = 0xa; -Event.GET_WINDOW_SIZE = 0xb; -Event.GRAPHICS_COMPONENT_INITIALIZED = 0xc; -Event.IMAGE_COMPONENT_INITIALIZED = 0xd; -Event.IMAGE_INITIALIZED = 0xe; -Event.INPUT_COMPONENT_INITIALIZED = 0xf; -Event.INSTANCE_CREATED = 0x10; -Event.INSTANCE_DISPOSED = 0x11; -Event.KEYBOARD_DOWN = 0x12; -Event.KEYBOARD_UP = 0x13; -Event.MOUSE_DOWN = 0x14; -Event.MOUSE_MOVE = 0x15; -Event.MOUSE_UP = 0x16; -Event.MOUSE_WHEEL = 0x17; -Event.OBJECT_CREATED = 0x18; -Event.OBJECT_INITIALIZED = 0x19; -Event.PAUSE = 0x1a; -Event.PROJECT_INITIALIZED = 0x1b; -Event.RESTART = 0x1c; -Event.START = 0x1d; -Event.TOUCH_CANCEL = 0x1e; -Event.TOUCH_END = 0x1f; -Event.TOUCH_MOVE = 0x20; -Event.TOUCH_START = 0x21; -Event.UPDATE_FROM_INSTANCE_AFTER = 0x22; -Event.UPDATE_FROM_INSTANCE_BEFORE = 0x23; -Event.UPDATE_INSTANCE_AFTER = 0x24; -Event.UPDATE_INSTANCE_BEFORE = 0x25; -Event.UPDATE_INSTANCE_PROPERTY = 0x26; -Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x27; -Event.MAX_EVENTS = 0x28; +Event.COMPONENT_CREATED = 0x1; +Event.COMPONENT_INITIALIZED = 0x2; +Event.CREATE_INSTANCE_BEFORE = 0x3; +Event.DISPOSE_INSTANCE = 0x4; +Event.DISPOSE_OBJECT = 0x5; +Event.DOM_COMPONENT_INITIALIZED = 0x6; +Event.ENTITY_CREATED = 0x7; +Event.ENTITY_INITIALIZED = 0x8; +Event.GET_RUNTIME = 0x9; +Event.GET_WINDOW_SIZE = 0xa; +Event.GRAPHICS_COMPONENT_INITIALIZED = 0xb; +Event.IMAGE_COMPONENT_INITIALIZED = 0xc; +Event.IMAGE_INITIALIZED = 0xd; +Event.INPUT_COMPONENT_INITIALIZED = 0xe; +Event.INSTANCE_CREATED = 0xf; +Event.INSTANCE_DISPOSED = 0x10; +Event.KEYBOARD_DOWN = 0x11; +Event.KEYBOARD_UP = 0x12; +Event.MOUSE_DOWN = 0x13; +Event.MOUSE_MOVE = 0x14; +Event.MOUSE_UP = 0x15; +Event.MOUSE_WHEEL = 0x16; +Event.OBJECT_CREATED = 0x17; +Event.OBJECT_INITIALIZED = 0x18; +Event.PAUSE = 0x19; +Event.PROJECT_INITIALIZED = 0x1a; +Event.RESTART = 0x1b; +Event.START = 0x1c; +Event.TOUCH_CANCEL = 0x1d; +Event.TOUCH_END = 0x1e; +Event.TOUCH_MOVE = 0x1f; +Event.TOUCH_START = 0x20; +Event.UPDATE_FROM_INSTANCE_AFTER = 0x21; +Event.UPDATE_FROM_INSTANCE_BEFORE = 0x22; +Event.UPDATE_INSTANCE_AFTER = 0x23; +Event.UPDATE_INSTANCE_BEFORE = 0x24; +Event.UPDATE_INSTANCE_PROPERTY = 0x25; +Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x26; +Event.MAX_EVENTS = 0x27; Event.GetEventName = function(eventId) { switch(eventId) { - case 0x1 : return 'before_render'; - case 0x2 : return 'component_created'; - case 0x3 : return 'component_initialized'; - case 0x4 : return 'create_instance_before'; - case 0x5 : return 'dispose_instance'; - case 0x6 : return 'dispose_object'; - case 0x7 : return 'dom_component_initialized'; - case 0x8 : return 'entity_created'; - case 0x9 : return 'entity_initialized'; - case 0xa : return 'get_runtime'; - case 0xb : return 'get_window_size'; - case 0xc : return 'graphics_component_initialized'; - case 0xd : return 'image_component_initialized'; - case 0xe : return 'image_initialized'; - case 0xf : return 'input_component_initialized'; - case 0x10 : return 'instance_created'; - case 0x11 : return 'instance_disposed'; - case 0x12 : return 'keyboard_down'; - case 0x13 : return 'keyboard_up'; - case 0x14 : return 'mouse_down'; - case 0x15 : return 'mouse_move'; - case 0x16 : return 'mouse_up'; - case 0x17 : return 'mouse_wheel'; - case 0x18 : return 'object_created'; - case 0x19 : return 'object_initialized'; - case 0x1a : return 'pause'; - case 0x1b : return 'project_initialized'; - case 0x1c : return 'restart'; - case 0x1d : return 'start'; - case 0x1e : return 'touch_cancel'; - case 0x1f : return 'touch_end'; - case 0x20 : return 'touch_move'; - case 0x21 : return 'touch_start'; - case 0x22 : return 'update_from_instance_after'; - case 0x23 : return 'update_from_instance_before'; - case 0x24 : return 'update_instance_after'; - case 0x25 : return 'update_instance_before'; - case 0x26 : return 'update_instance_property'; - case 0x27 : return 'update_property_from_instance'; + case 0x1 : return 'component_created'; + case 0x2 : return 'component_initialized'; + case 0x3 : return 'create_instance_before'; + case 0x4 : return 'dispose_instance'; + case 0x5 : return 'dispose_object'; + case 0x6 : return 'dom_component_initialized'; + case 0x7 : return 'entity_created'; + case 0x8 : return 'entity_initialized'; + case 0x9 : return 'get_runtime'; + case 0xa : return 'get_window_size'; + case 0xb : return 'graphics_component_initialized'; + case 0xc : return 'image_component_initialized'; + case 0xd : return 'image_initialized'; + case 0xe : return 'input_component_initialized'; + case 0xf : return 'instance_created'; + case 0x10 : return 'instance_disposed'; + case 0x11 : return 'keyboard_down'; + case 0x12 : return 'keyboard_up'; + case 0x13 : return 'mouse_down'; + case 0x14 : return 'mouse_move'; + case 0x15 : return 'mouse_up'; + case 0x16 : return 'mouse_wheel'; + case 0x17 : return 'object_created'; + case 0x18 : return 'object_initialized'; + case 0x19 : return 'pause'; + case 0x1a : return 'project_initialized'; + case 0x1b : return 'restart'; + case 0x1c : return 'start'; + case 0x1d : return 'touch_cancel'; + case 0x1e : return 'touch_end'; + case 0x1f : return 'touch_move'; + case 0x20 : return 'touch_start'; + case 0x21 : return 'update_from_instance_after'; + case 0x22 : return 'update_from_instance_before'; + case 0x23 : return 'update_instance_after'; + case 0x24 : return 'update_instance_before'; + case 0x25 : return 'update_instance_property'; + case 0x26 : return 'update_property_from_instance'; default : throw new Error('Event type not defined : ' + eventId); } @@ -2384,6 +2382,8 @@ class R3Object extends Event { Object.assign(this, options); + this.emit(Event.OBJECT_CREATED, this); + if (options.callDepth === 0) { this.initialize(); } else { @@ -2857,11 +2857,22 @@ class Component extends R3Object { if (delayInstance === true) { console.log('Instance creation delayed for ' + this.name); } else { + /** + * Set the runtime + */ this.setRuntime(); + + /** + * Let the runtime build the instance + */ this.instance = this.runtime.buildInstance(this); + + /** + * Notify anyone who might be interested + */ this.emit(Event.INSTANCE_CREATED, this); } - } + }.bind(this) ); } diff --git a/package.json b/package.json index 80ffade..4ba4671 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "r3", - "version" : "2.0.784", + "version" : "2.0.788", "description": "", "private": true, "dependencies": { diff --git a/r3.php b/r3.php index f6f1654..7dabf6c 100755 --- a/r3.php +++ b/r3.php @@ -745,6 +745,7 @@ function getEventListenerInfo($item) return [ 'eventName' => $eventName, + 'fullEventName' => 'Event.'.$eventName, 'returns' => $returns, 'comment' => $comment, 'methodName' => $methodName, @@ -773,7 +774,7 @@ function generateEventListenersStart($file, $tokens) $info = getEventListenerInfo($item); - $updates = str_replace('FULL_EVENT_NAME', 'Event.' . $info['eventName'], $template); + $updates = str_replace('FULL_EVENT_NAME', $info['fullEventName'], $template); $updates = str_replace('EVENT_NAME', $info['eventName'], $updates); $updates = str_replace('CALL_BACK', $info['methodName'], $updates); @@ -831,7 +832,7 @@ function generateStaticEventListenersStart($file, $tokens) $info = getEventListenerInfo($item); - $updates = str_replace('FULL_EVENT_NAME', 'Event.' . $info['eventName'], $template); + $updates = str_replace('FULL_EVENT_NAME', $info['fullEventName'], $template); $updates = str_replace('EVENT_NAME', $info['eventName'], $updates); $updates = str_replace('CALL_BACK', $info['methodName'], $updates); @@ -1100,7 +1101,7 @@ function getStaticEventListenerUpdates($template, $tokens, $token) $updated = str_replace('METHOD_NAME', $info['methodName'], $updated); $updated = str_replace('METHOD_ARGS', $methodArgs, $updated); - $comment = 'Listens to events of type ' . $info['eventName'] . ' and executes this function. ' . $info['comment']; + $comment = 'Listens to events of type ' . $info['fullEventName'] . ' and executes this function. ' . $info['comment']; $comment = wordwrap($comment, 110, "\n * "); $returns = wordwrap($returns, 110, "\n * "); diff --git a/src/r3/r3-component/r3-component.js b/src/r3/r3-component/r3-component.js index 66f6b40..f51a245 100644 --- a/src/r3/r3-component/r3-component.js +++ b/src/r3/r3-component/r3-component.js @@ -215,14 +215,23 @@ class Component extends R3Object { if (delayInstance === true) { console.log('Instance creation delayed for ' + this.name); } else { + /** + * Set the runtime + */ this.setRuntime(); + + /** + * Let the runtime build the instance + */ this.instance = this.runtime.buildInstance(this); + + /** + * Notify anyone who might be interested + */ this.emit(Event.INSTANCE_CREATED, this); } - } + }.bind(this) ); - - //GENERATED_CREATE_INSTANCE_METHOD_END //CUSTOM_CREATE_INSTANCE_METHOD_START diff --git a/src/r3/r3-event.js b/src/r3/r3-event.js index 2ae39ac..1b59ce9 100644 --- a/src/r3/r3-event.js +++ b/src/r3/r3-event.js @@ -336,89 +336,87 @@ class Event { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //GENERATED_EVENTS_START -Event.BEFORE_RENDER = 0x1; -Event.COMPONENT_CREATED = 0x2; -Event.COMPONENT_INITIALIZED = 0x3; -Event.CREATE_INSTANCE_BEFORE = 0x4; -Event.DISPOSE_INSTANCE = 0x5; -Event.DISPOSE_OBJECT = 0x6; -Event.DOM_COMPONENT_INITIALIZED = 0x7; -Event.ENTITY_CREATED = 0x8; -Event.ENTITY_INITIALIZED = 0x9; -Event.GET_RUNTIME = 0xa; -Event.GET_WINDOW_SIZE = 0xb; -Event.GRAPHICS_COMPONENT_INITIALIZED = 0xc; -Event.IMAGE_COMPONENT_INITIALIZED = 0xd; -Event.IMAGE_INITIALIZED = 0xe; -Event.INPUT_COMPONENT_INITIALIZED = 0xf; -Event.INSTANCE_CREATED = 0x10; -Event.INSTANCE_DISPOSED = 0x11; -Event.KEYBOARD_DOWN = 0x12; -Event.KEYBOARD_UP = 0x13; -Event.MOUSE_DOWN = 0x14; -Event.MOUSE_MOVE = 0x15; -Event.MOUSE_UP = 0x16; -Event.MOUSE_WHEEL = 0x17; -Event.OBJECT_CREATED = 0x18; -Event.OBJECT_INITIALIZED = 0x19; -Event.PAUSE = 0x1a; -Event.PROJECT_INITIALIZED = 0x1b; -Event.RESTART = 0x1c; -Event.START = 0x1d; -Event.TOUCH_CANCEL = 0x1e; -Event.TOUCH_END = 0x1f; -Event.TOUCH_MOVE = 0x20; -Event.TOUCH_START = 0x21; -Event.UPDATE_FROM_INSTANCE_AFTER = 0x22; -Event.UPDATE_FROM_INSTANCE_BEFORE = 0x23; -Event.UPDATE_INSTANCE_AFTER = 0x24; -Event.UPDATE_INSTANCE_BEFORE = 0x25; -Event.UPDATE_INSTANCE_PROPERTY = 0x26; -Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x27; -Event.MAX_EVENTS = 0x28; +Event.COMPONENT_CREATED = 0x1; +Event.COMPONENT_INITIALIZED = 0x2; +Event.CREATE_INSTANCE_BEFORE = 0x3; +Event.DISPOSE_INSTANCE = 0x4; +Event.DISPOSE_OBJECT = 0x5; +Event.DOM_COMPONENT_INITIALIZED = 0x6; +Event.ENTITY_CREATED = 0x7; +Event.ENTITY_INITIALIZED = 0x8; +Event.GET_RUNTIME = 0x9; +Event.GET_WINDOW_SIZE = 0xa; +Event.GRAPHICS_COMPONENT_INITIALIZED = 0xb; +Event.IMAGE_COMPONENT_INITIALIZED = 0xc; +Event.IMAGE_INITIALIZED = 0xd; +Event.INPUT_COMPONENT_INITIALIZED = 0xe; +Event.INSTANCE_CREATED = 0xf; +Event.INSTANCE_DISPOSED = 0x10; +Event.KEYBOARD_DOWN = 0x11; +Event.KEYBOARD_UP = 0x12; +Event.MOUSE_DOWN = 0x13; +Event.MOUSE_MOVE = 0x14; +Event.MOUSE_UP = 0x15; +Event.MOUSE_WHEEL = 0x16; +Event.OBJECT_CREATED = 0x17; +Event.OBJECT_INITIALIZED = 0x18; +Event.PAUSE = 0x19; +Event.PROJECT_INITIALIZED = 0x1a; +Event.RESTART = 0x1b; +Event.START = 0x1c; +Event.TOUCH_CANCEL = 0x1d; +Event.TOUCH_END = 0x1e; +Event.TOUCH_MOVE = 0x1f; +Event.TOUCH_START = 0x20; +Event.UPDATE_FROM_INSTANCE_AFTER = 0x21; +Event.UPDATE_FROM_INSTANCE_BEFORE = 0x22; +Event.UPDATE_INSTANCE_AFTER = 0x23; +Event.UPDATE_INSTANCE_BEFORE = 0x24; +Event.UPDATE_INSTANCE_PROPERTY = 0x25; +Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x26; +Event.MAX_EVENTS = 0x27; Event.GetEventName = function(eventId) { switch(eventId) { - case 0x1 : return 'before_render'; - case 0x2 : return 'component_created'; - case 0x3 : return 'component_initialized'; - case 0x4 : return 'create_instance_before'; - case 0x5 : return 'dispose_instance'; - case 0x6 : return 'dispose_object'; - case 0x7 : return 'dom_component_initialized'; - case 0x8 : return 'entity_created'; - case 0x9 : return 'entity_initialized'; - case 0xa : return 'get_runtime'; - case 0xb : return 'get_window_size'; - case 0xc : return 'graphics_component_initialized'; - case 0xd : return 'image_component_initialized'; - case 0xe : return 'image_initialized'; - case 0xf : return 'input_component_initialized'; - case 0x10 : return 'instance_created'; - case 0x11 : return 'instance_disposed'; - case 0x12 : return 'keyboard_down'; - case 0x13 : return 'keyboard_up'; - case 0x14 : return 'mouse_down'; - case 0x15 : return 'mouse_move'; - case 0x16 : return 'mouse_up'; - case 0x17 : return 'mouse_wheel'; - case 0x18 : return 'object_created'; - case 0x19 : return 'object_initialized'; - case 0x1a : return 'pause'; - case 0x1b : return 'project_initialized'; - case 0x1c : return 'restart'; - case 0x1d : return 'start'; - case 0x1e : return 'touch_cancel'; - case 0x1f : return 'touch_end'; - case 0x20 : return 'touch_move'; - case 0x21 : return 'touch_start'; - case 0x22 : return 'update_from_instance_after'; - case 0x23 : return 'update_from_instance_before'; - case 0x24 : return 'update_instance_after'; - case 0x25 : return 'update_instance_before'; - case 0x26 : return 'update_instance_property'; - case 0x27 : return 'update_property_from_instance'; + case 0x1 : return 'component_created'; + case 0x2 : return 'component_initialized'; + case 0x3 : return 'create_instance_before'; + case 0x4 : return 'dispose_instance'; + case 0x5 : return 'dispose_object'; + case 0x6 : return 'dom_component_initialized'; + case 0x7 : return 'entity_created'; + case 0x8 : return 'entity_initialized'; + case 0x9 : return 'get_runtime'; + case 0xa : return 'get_window_size'; + case 0xb : return 'graphics_component_initialized'; + case 0xc : return 'image_component_initialized'; + case 0xd : return 'image_initialized'; + case 0xe : return 'input_component_initialized'; + case 0xf : return 'instance_created'; + case 0x10 : return 'instance_disposed'; + case 0x11 : return 'keyboard_down'; + case 0x12 : return 'keyboard_up'; + case 0x13 : return 'mouse_down'; + case 0x14 : return 'mouse_move'; + case 0x15 : return 'mouse_up'; + case 0x16 : return 'mouse_wheel'; + case 0x17 : return 'object_created'; + case 0x18 : return 'object_initialized'; + case 0x19 : return 'pause'; + case 0x1a : return 'project_initialized'; + case 0x1b : return 'restart'; + case 0x1c : return 'start'; + case 0x1d : return 'touch_cancel'; + case 0x1e : return 'touch_end'; + case 0x1f : return 'touch_move'; + case 0x20 : return 'touch_start'; + case 0x21 : return 'update_from_instance_after'; + case 0x22 : return 'update_from_instance_before'; + case 0x23 : return 'update_instance_after'; + case 0x24 : return 'update_instance_before'; + case 0x25 : return 'update_instance_property'; + case 0x26 : return 'update_property_from_instance'; default : throw new Error('Event type not defined : ' + eventId); } diff --git a/src/r3/r3-r3-object.js b/src/r3/r3-r3-object.js index abef446..401b070 100644 --- a/src/r3/r3-r3-object.js +++ b/src/r3/r3-r3-object.js @@ -148,6 +148,7 @@ class R3Object extends Event { Object.assign(this, options); //CUSTOM_BEFORE_INIT_START + this.emit(Event.OBJECT_CREATED, this); //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { diff --git a/src/r3/r3-r3.js b/src/r3/r3-r3.js index ddb230a..5c3723a 100644 --- a/src/r3/r3-r3.js +++ b/src/r3/r3-r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.784'; - static compileDate = '2021 Sep 19 - 21:28:13 pm'; + static version = '2.0.788'; + static compileDate = '2021 Sep 19 - 21:34:33 pm'; } //GENERATED_IMPORTS_START diff --git a/src/r3/r3-system/r3-system-d-o-m.js b/src/r3/r3-system/r3-system-d-o-m.js index 8e7e419..4f7d7fd 100644 --- a/src/r3/r3-system/r3-system-d-o-m.js +++ b/src/r3/r3-system/r3-system-d-o-m.js @@ -188,9 +188,9 @@ class SystemDOM extends System { /** * OnDomComponentInitialized() - * - Listens to events of type Event.DOM_COMPONENT_INITIALIZED and executes this function. + * - Listens to events of type Event.DOM_COMPONENT_INITIALIZED and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnDomComponentInitialized(object) { diff --git a/src/r3/r3-system/r3-system-input.js b/src/r3/r3-system/r3-system-input.js index a1e4cb7..d32ee9b 100644 --- a/src/r3/r3-system/r3-system-input.js +++ b/src/r3/r3-system/r3-system-input.js @@ -269,9 +269,9 @@ class SystemInput extends System { /** * OnTouchStart() - * - Listens to events of type Event.TOUCH_START and executes this function. + * - Listens to events of type Event.TOUCH_START and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnTouchStart(object) { @@ -285,9 +285,9 @@ class SystemInput extends System { /** * OnTouchEnd() - * - Listens to events of type Event.TOUCH_END and executes this function. + * - Listens to events of type Event.TOUCH_END and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnTouchEnd(object) { @@ -301,9 +301,9 @@ class SystemInput extends System { /** * OnTouchMove() - * - Listens to events of type Event.TOUCH_MOVE and executes this function. + * - Listens to events of type Event.TOUCH_MOVE and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnTouchMove(object) { @@ -317,9 +317,9 @@ class SystemInput extends System { /** * OnTouchCancel() - * - Listens to events of type Event.TOUCH_CANCEL and executes this function. + * - Listens to events of type Event.TOUCH_CANCEL and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnTouchCancel(object) { @@ -333,9 +333,9 @@ class SystemInput extends System { /** * OnKeyboardDown() - * - Listens to events of type Event.KEYBOARD_DOWN and executes this function. + * - Listens to events of type Event.KEYBOARD_DOWN and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnKeyboardDown(object) { @@ -349,9 +349,9 @@ class SystemInput extends System { /** * OnKeyboardUp() - * - Listens to events of type Event.KEYBOARD_UP and executes this function. + * - Listens to events of type Event.KEYBOARD_UP and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnKeyboardUp(object) { @@ -365,9 +365,9 @@ class SystemInput extends System { /** * OnMouseDown() - * - Listens to events of type Event.MOUSE_DOWN and executes this function. + * - Listens to events of type Event.MOUSE_DOWN and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnMouseDown(object) { @@ -381,9 +381,9 @@ class SystemInput extends System { /** * OnMouseUp() - * - Listens to events of type Event.MOUSE_UP and executes this function. + * - Listens to events of type Event.MOUSE_UP and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnMouseUp(object) { @@ -397,9 +397,9 @@ class SystemInput extends System { /** * OnMouseMove() - * - Listens to events of type Event.MOUSE_MOVE and executes this function. + * - Listens to events of type Event.MOUSE_MOVE and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnMouseMove(object) { @@ -413,9 +413,9 @@ class SystemInput extends System { /** * OnMouseWheel() - * - Listens to events of type Event.MOUSE_WHEEL and executes this function. + * - Listens to events of type Event.MOUSE_WHEEL and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnMouseWheel(object) { diff --git a/src/r3/r3-system/r3-system-linking.js b/src/r3/r3-system/r3-system-linking.js index 921783b..9b1a8fb 100644 --- a/src/r3/r3-system/r3-system-linking.js +++ b/src/r3/r3-system/r3-system-linking.js @@ -217,7 +217,7 @@ class SystemLinking extends System { /** * OnObjectCreated() - * - Listens to events of type OBJECT_CREATED and executes this function. + * - Listens to events of type Event.OBJECT_CREATED and executes this function. * @param object (The event data passed as argument - typically an R3Object) * @return */ @@ -234,7 +234,7 @@ class SystemLinking extends System { /** * OnObjectInitialized() - * - Listens to events of type OBJECT_INITIALIZED and executes this function. + * - Listens to events of type Event.OBJECT_INITIALIZED and executes this function. * @param object (The event data passed as argument - typically an R3Object) * @return */ @@ -251,7 +251,7 @@ class SystemLinking extends System { /** * OnInstanceCreated() - * - Listens to events of type INSTANCE_CREATED and executes this function. + * - Listens to events of type Event.INSTANCE_CREATED and executes this function. * @param object (The event data passed as argument - typically an R3Object) * @return */ @@ -268,7 +268,7 @@ class SystemLinking extends System { /** * OnCreateInstanceBefore() - * - Listens to events of type CREATE_INSTANCE_BEFORE and executes this function. + * - Listens to events of type Event.CREATE_INSTANCE_BEFORE and executes this function. * @param object (The event data passed as argument - typically an R3Object) * @return boolean delayInstance which indicates whether or not instance creation is delayed (handled) by * another system. (i.e. where instance creation order is of importance) diff --git a/src/r3/r3-system/r3-system-render.js b/src/r3/r3-system/r3-system-render.js index 37c0f7f..f00922e 100644 --- a/src/r3/r3-system/r3-system-render.js +++ b/src/r3/r3-system/r3-system-render.js @@ -188,9 +188,9 @@ class SystemRender extends System { /** * OnInstanceCreated() - * - Listens to events of type Event.INSTANCE_CREATED and executes this function. + * - Listens to events of type Event.INSTANCE_CREATED and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnInstanceCreated(object) { diff --git a/src/r3/r3-system/r3-system-runtime.js b/src/r3/r3-system/r3-system-runtime.js index 61738a5..5c5b6dd 100644 --- a/src/r3/r3-system/r3-system-runtime.js +++ b/src/r3/r3-system/r3-system-runtime.js @@ -212,9 +212,9 @@ class SystemRuntime extends System { /** * OnGetRuntime() - * - Listens to events of type Event.GET_RUNTIME and executes this function. + * - Listens to events of type Event.GET_RUNTIME and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnGetRuntime(object) { @@ -245,9 +245,9 @@ class SystemRuntime extends System { /** * OnProjectInitialized() - * - Listens to events of type Event.PROJECT_INITIALIZED and executes this function. + * - Listens to events of type Event.PROJECT_INITIALIZED and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnProjectInitialized(object) { diff --git a/src/r3/r3-system/r3-system-storage.js b/src/r3/r3-system/r3-system-storage.js index 4c81fa0..e6a7901 100644 --- a/src/r3/r3-system/r3-system-storage.js +++ b/src/r3/r3-system/r3-system-storage.js @@ -188,9 +188,9 @@ class SystemStorage extends System { /** * OnImageComponentInitialized() - * - Listens to events of type Event.IMAGE_COMPONENT_INITIALIZED and executes this function. + * - Listens to events of type Event.IMAGE_COMPONENT_INITIALIZED and executes this function. * @param object (The event data passed as argument - typically an R3Object) - * @return null + * @return */ static OnImageComponentInitialized(object) { diff --git a/src/templates/create_instance.template b/src/templates/create_instance.template index c264ce9..1991102 100644 --- a/src/templates/create_instance.template +++ b/src/templates/create_instance.template @@ -20,5 +20,5 @@ */ this.emit(Event.INSTANCE_CREATED, this); } - } + }.bind(this) ); \ No newline at end of file diff --git a/version b/version index edf1cd1..523648f 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.0.784 \ No newline at end of file +2.0.788 \ No newline at end of file