custom after instance

master
Theunis J. Botha 2021-09-19 21:46:34 +02:00
parent 85f5a8bb2f
commit 2deca7016f
16 changed files with 177 additions and 129 deletions

139
dist/r3.js vendored
View File

@ -1,6 +1,6 @@
class R3 {
static version = '2.0.788';
static compileDate = '2021 Sep 19 - 21:34:33 pm';
static version = '2.0.790';
static compileDate = '2021 Sep 19 - 21:43:21 pm';
}
class Runtime {
@ -1916,9 +1916,9 @@ class SystemStorage extends System {
*/
static Start(options) {
SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED'] = Event.Subscribe(
Event.IMAGE_COMPONENT_INITIALIZED,
SystemStorage.OnImageComponentInitialized
SystemStorage.Subscriptions['IMAGE_INSTANCE_CREATED'] = Event.Subscribe(
Event.IMAGE_INSTANCE_CREATED,
SystemStorage.OnImageInstanceCreated
);
SystemStorage.Started = true;
@ -1934,8 +1934,8 @@ class SystemStorage extends System {
*/
static Stop(options) {
SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED'].remove();
delete SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED'];
SystemStorage.Subscriptions['IMAGE_INSTANCE_CREATED'].remove();
delete SystemStorage.Subscriptions['IMAGE_INSTANCE_CREATED'];
SystemStorage.Started = false;
@ -1944,12 +1944,18 @@ class SystemStorage extends System {
}
/**
* OnImageComponentInitialized()
* - Listens to events of type Event.IMAGE_COMPONENT_INITIALIZED and executes this function.
* OnImageInstanceCreated()
* - Listens to events of type Event.IMAGE_INSTANCE_CREATED and executes this function.
* @param object (The event data passed as argument - typically an R3Object)
* @return
*/
static OnImageComponentInitialized(object) {
static OnImageInstanceCreated(object) {
//GENERATED_STATIC_ON_IMAGE_INSTANCE_CREATED_METHOD_START
//GENERATED_STATIC_ON_IMAGE_INSTANCE_CREATED_METHOD_END
//CUSTOM_STATIC_ON_IMAGE_INSTANCE_CREATED_METHOD_START
//CUSTOM_STATIC_ON_IMAGE_INSTANCE_CREATED_METHOD_END
}
@ -2203,32 +2209,33 @@ 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.IMAGE_INSTANCE_CREATED = 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.GetEventName = function(eventId) {
@ -2246,31 +2253,32 @@ Event.GetEventName = function(eventId) {
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';
case 0xe : return 'image_instance_created';
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';
default :
throw new Error('Event type not defined : ' + eventId);
}
@ -2413,6 +2421,7 @@ class R3Object extends Event {
Event.Emit(Event.OBJECT_INITIALIZED, this);
this.createInstance();
}
}
@ -2547,6 +2556,7 @@ class Entity extends R3Object {
this.initialized = true;
this.createInstance();
}
Event.Emit(Event.OBJECT_INITIALIZED, this);
@ -2840,6 +2850,7 @@ class Component extends R3Object {
Event.Emit(Event.COMPONENT_INITIALIZED, this);
this.createInstance();
}
}
@ -3166,6 +3177,7 @@ class ComponentDOM extends Component {
Event.Emit(Event.DOM_COMPONENT_INITIALIZED, this);
this.createInstance();
}
}
@ -3669,6 +3681,7 @@ class ComponentGraphics extends Component {
Event.Emit(Event.GRAPHICS_COMPONENT_INITIALIZED, this);
this.createInstance();
}
}
@ -4218,6 +4231,8 @@ class ComponentImage extends ComponentGraphics {
Event.Emit(Event.IMAGE_COMPONENT_INITIALIZED, this);
this.createInstance();
Event.Emit(Event.IMAGE_INSTANCE_CREATED, this);
}
}
@ -4986,6 +5001,7 @@ class ComponentInput extends Component {
Event.Emit(Event.INPUT_COMPONENT_INITIALIZED, this);
this.createInstance();
}
}
@ -5313,6 +5329,7 @@ class Project extends R3Object {
this.initialized = true;
this.createInstance();
}
Event.Emit(Event.OBJECT_INITIALIZED, this);

View File

@ -1,6 +1,6 @@
{
"name": "r3",
"version" : "2.0.788",
"version" : "2.0.790",
"description": "",
"private": true,
"dependencies": {

View File

@ -323,6 +323,9 @@ class ComponentDOM extends Component {
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
//CUSTOM_AFTER_CREATE_INSTANCE_END
}
//GENERATED_INITIALIZE_METHOD_END

View File

@ -287,6 +287,9 @@ class ComponentGraphics extends Component {
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
//CUSTOM_AFTER_CREATE_INSTANCE_END
}
//GENERATED_INITIALIZE_METHOD_END

View File

@ -652,6 +652,10 @@ class ComponentImage extends ComponentGraphics {
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
Event.Emit(Event.IMAGE_INSTANCE_CREATED, this);
//CUSTOM_AFTER_CREATE_INSTANCE_END
}
//GENERATED_INITIALIZE_METHOD_END

View File

@ -287,6 +287,9 @@ class ComponentInput extends Component {
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
//CUSTOM_AFTER_CREATE_INSTANCE_END
}
//GENERATED_INITIALIZE_METHOD_END

View File

@ -193,6 +193,9 @@ class Component extends R3Object {
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
//CUSTOM_AFTER_CREATE_INSTANCE_END
}
//GENERATED_INITIALIZE_METHOD_END

View File

@ -181,6 +181,9 @@ class Entity extends R3Object {
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
//CUSTOM_AFTER_CREATE_INSTANCE_END
}
//GENERATED_INITIALIZE_METHOD_END

View File

@ -349,32 +349,33 @@ 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.IMAGE_INSTANCE_CREATED = 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.GetEventName = function(eventId) {
@ -392,31 +393,32 @@ Event.GetEventName = function(eventId) {
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';
case 0xe : return 'image_instance_created';
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';
default :
throw new Error('Event type not defined : ' + eventId);
}

View File

@ -187,6 +187,9 @@ class Project extends R3Object {
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
//CUSTOM_AFTER_CREATE_INSTANCE_END
}
//GENERATED_INITIALIZE_METHOD_END

View File

@ -191,6 +191,9 @@ class R3Object extends Event {
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
//CUSTOM_AFTER_CREATE_INSTANCE_END
}
//GENERATED_INITIALIZE_METHOD_END

View File

@ -1,6 +1,6 @@
class R3 {
static version = '2.0.788';
static compileDate = '2021 Sep 19 - 21:34:33 pm';
static version = '2.0.790';
static compileDate = '2021 Sep 19 - 21:43:21 pm';
}
//GENERATED_IMPORTS_START

View File

@ -63,7 +63,7 @@ const System = require('.././r3-system.js');
CUSTOM_EVENT_LISTENERS_END
CUSTOM_STATIC_EVENT_LISTENERS_START
Event.IMAGE_COMPONENT_INITIALIZED
Event.IMAGE_INSTANCE_CREATED
CUSTOM_STATIC_EVENT_LISTENERS_END
TEMPLATE_METHODS_START
@ -127,9 +127,9 @@ class SystemStorage extends System {
//GENERATED_STATIC_START_METHOD_START
//GENERATED_STATIC_EVENT_LISTENERS_START_START
SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED'] = Event.Subscribe(
Event.IMAGE_COMPONENT_INITIALIZED,
SystemStorage.OnImageComponentInitialized
SystemStorage.Subscriptions['IMAGE_INSTANCE_CREATED'] = Event.Subscribe(
Event.IMAGE_INSTANCE_CREATED,
SystemStorage.OnImageInstanceCreated
);
//GENERATED_STATIC_EVENT_LISTENERS_START_END
@ -158,8 +158,8 @@ class SystemStorage extends System {
//GENERATED_STATIC_STOP_METHOD_START
//GENERATED_STATIC_EVENT_LISTENERS_STOP_START
SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED'].remove();
delete SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED'];
SystemStorage.Subscriptions['IMAGE_INSTANCE_CREATED'].remove();
delete SystemStorage.Subscriptions['IMAGE_INSTANCE_CREATED'];
//GENERATED_STATIC_EVENT_LISTENERS_STOP_END
@ -187,18 +187,18 @@ class SystemStorage extends System {
//GENERATED_STATIC_EVENT_LISTENER_METHODS_START
/**
* OnImageComponentInitialized()
* - Listens to events of type Event.IMAGE_COMPONENT_INITIALIZED and executes this function.
* OnImageInstanceCreated()
* - Listens to events of type Event.IMAGE_INSTANCE_CREATED and executes this function.
* @param object (The event data passed as argument - typically an R3Object)
* @return
*/
static OnImageComponentInitialized(object) {
static OnImageInstanceCreated(object) {
//GENERATED_STATIC_ON_IMAGE_COMPONENT_INITIALIZED_METHOD_START
//GENERATED_STATIC_ON_IMAGE_COMPONENT_INITIALIZED_METHOD_END
//GENERATED_STATIC_ON_IMAGE_INSTANCE_CREATED_METHOD_START
//GENERATED_STATIC_ON_IMAGE_INSTANCE_CREATED_METHOD_END
//CUSTOM_STATIC_ON_IMAGE_COMPONENT_INITIALIZED_METHOD_START
//CUSTOM_STATIC_ON_IMAGE_COMPONENT_INITIALIZED_METHOD_END
//CUSTOM_STATIC_ON_IMAGE_INSTANCE_CREATED_METHOD_START
//CUSTOM_STATIC_ON_IMAGE_INSTANCE_CREATED_METHOD_END
}
//GENERATED_STATIC_EVENT_LISTENER_METHODS_END

View File

@ -14,4 +14,7 @@
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
//CUSTOM_AFTER_CREATE_INSTANCE_END
}

View File

@ -60,6 +60,7 @@ GENERATED_UPDATE_FROM_INSTANCE_METHOD
GENERATED_UPDATE_FROM_INSTANCE_OPTIONS
GENERATED_UPDATE_INSTANCE_METHOD
GENERATED_UPDATE_INSTANCE_OPTIONS
CUSTOM_AFTER_CREATE_INSTANCE
CUSTOM_AFTER_INIT
CUSTOM_ASYNC_METHOD
CUSTOM_BEFORE_CREATE_INSTANCE

View File

@ -1 +1 @@
2.0.788
2.0.790