From cd6664aceda2388100c33c77fa477f36b47b1527 Mon Sep 17 00:00:00 2001 From: "Theunis J. Botha" Date: Wed, 8 Sep 2021 08:46:38 +0200 Subject: [PATCH] new DOM system --- .r3_history | 1 + dist/r3.js | 414 +++++++++++++++------ package.json | 2 +- src/r3/index.js | 1 + src/r3/r3-component/r3-canvas.js | 13 +- src/r3/r3-component/r3-component.js | 37 +- src/r3/r3-component/r3-d-o-m.js | 33 +- src/r3/r3-component/r3-image.js | 9 +- src/r3/r3-component/r3-input.js | 9 +- src/r3/r3-component/r3-touch.js | 9 +- src/r3/r3-event.js | 109 +++--- src/r3/r3-project.js | 6 +- src/r3/r3-r3-object.js | 23 +- src/r3/r3-r3.js | 4 +- src/r3/r3-runtime/r3-bullet.js | 3 +- src/r3/r3-runtime/r3-code-mirror.js | 3 +- src/r3/r3-runtime/r3-coder.js | 3 +- src/r3/r3-runtime/r3-control-kit.js | 3 +- src/r3/r3-runtime/r3-default.js | 3 +- src/r3/r3-runtime/r3-g-u-i.js | 3 +- src/r3/r3-runtime/r3-graphics.js | 3 +- src/r3/r3-runtime/r3-physics.js | 3 +- src/r3/r3-runtime/r3-runtime.js | 3 +- src/r3/r3-runtime/r3-socket.js | 3 +- src/r3/r3-runtime/r3-statistics.js | 3 +- src/r3/r3-runtime/r3-stats.js | 3 +- src/r3/r3-runtime/r3-three.js | 3 +- src/r3/r3-system/index.js | 2 + src/r3/r3-system/r3-system-d-o-m.js | 217 +++++++++++ src/r3/r3-system/r3-system-input.js | 3 +- src/r3/r3-system/r3-system-linking.js | 5 +- src/r3/r3-system/r3-system-socket.js | 4 +- src/r3/r3-system/r3-system.js | 12 +- src/r3/r3-utils.js | 3 +- src/templates/constructor.template | 3 +- src/templates/constructor_extends.template | 3 +- src/templates/initialized.template | 2 + src/templates/token.db | 4 + version | 2 +- 39 files changed, 711 insertions(+), 258 deletions(-) create mode 100644 src/r3/r3-system/r3-system-d-o-m.js create mode 100644 src/templates/initialized.template diff --git a/.r3_history b/.r3_history index ce8a062..ca9a030 100644 --- a/.r3_history +++ b/.r3_history @@ -26,3 +26,4 @@ r3 create ControlKit extends GUI ./r3-runtime/ r3 create Stats extends Statistics ./r3-runtime/ r3 create DOM extends Component ./r3-component/ r3 create Canvas extends DOM ./r3-component/ +r3 create SystemDOM system diff --git a/dist/r3.js b/dist/r3.js index a87209a..bb6a20e 100644 --- a/dist/r3.js +++ b/dist/r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.212'; - static compileDate = '2021 Sep 08 - 08:24:42 am'; + static version = '2.0.221'; + static compileDate = '2021 Sep 08 - 08:46:07 am'; } /** @@ -37,8 +37,7 @@ class System { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -50,10 +49,11 @@ class System { System.Started = false; System.Subscriptions = {}; -System.SYSTEM_INPUT = 0x0; -System.SYSTEM_LINKING = 0x1; -System.SYSTEM_SOCKET = 0x2; -System.MAX_SYSTEMS = 0x3; +System.SYSTEM_DOM = 0x0; +System.SYSTEM_INPUT = 0x1; +System.SYSTEM_LINKING = 0x2; +System.SYSTEM_SOCKET = 0x3; +System.MAX_SYSTEMS = 0x4; class Event { @@ -74,8 +74,7 @@ class Event { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -295,62 +294,66 @@ class Event { } Event.COMPONENT_CREATED = 0x1; -Event.CREATE_INSTANCE_BEFORE = 0x2; -Event.DISPOSE_INSTANCE = 0x3; -Event.DISPOSE_OBJECT = 0x4; -Event.GET_RUNTIME = 0x5; -Event.GET_WINDOW_SIZE = 0x6; -Event.INPUT_COMPONENT_INITIALIZED = 0x7; -Event.INSTANCE_CREATED = 0x8; -Event.INSTANCE_DISPOSED = 0x9; -Event.KEYBOARD_DOWN = 0xa; -Event.KEYBOARD_UP = 0xb; -Event.MOUSE_DOWN = 0xc; -Event.MOUSE_MOVE = 0xd; -Event.MOUSE_UP = 0xe; -Event.MOUSE_WHEEL = 0xf; -Event.OBJECT_CREATED = 0x10; -Event.OBJECT_INITIALIZED = 0x11; -Event.PAUSE = 0x12; -Event.RESTART = 0x13; -Event.START = 0x14; -Event.TOUCH_CANCEL = 0x15; -Event.TOUCH_END = 0x16; -Event.TOUCH_MOVE = 0x17; -Event.TOUCH_START = 0x18; -Event.UPDATE_FROM_INSTANCE_AFTER = 0x19; -Event.UPDATE_FROM_INSTANCE_BEFORE = 0x1a; -Event.MAX_EVENTS = 0x1b; +Event.COMPONENT_INITIALIZED = 0x2; +Event.CREATE_INSTANCE_BEFORE = 0x3; +Event.DISPOSE_INSTANCE = 0x4; +Event.DISPOSE_OBJECT = 0x5; +Event.DOM_COMPONENT_INITIALIZED = 0x6; +Event.GET_RUNTIME = 0x7; +Event.GET_WINDOW_SIZE = 0x8; +Event.INPUT_COMPONENT_INITIALIZED = 0x9; +Event.INSTANCE_CREATED = 0xa; +Event.INSTANCE_DISPOSED = 0xb; +Event.KEYBOARD_DOWN = 0xc; +Event.KEYBOARD_UP = 0xd; +Event.MOUSE_DOWN = 0xe; +Event.MOUSE_MOVE = 0xf; +Event.MOUSE_UP = 0x10; +Event.MOUSE_WHEEL = 0x11; +Event.OBJECT_CREATED = 0x12; +Event.OBJECT_INITIALIZED = 0x13; +Event.PAUSE = 0x14; +Event.RESTART = 0x15; +Event.START = 0x16; +Event.TOUCH_CANCEL = 0x17; +Event.TOUCH_END = 0x18; +Event.TOUCH_MOVE = 0x19; +Event.TOUCH_START = 0x1a; +Event.UPDATE_FROM_INSTANCE_AFTER = 0x1b; +Event.UPDATE_FROM_INSTANCE_BEFORE = 0x1c; +Event.MAX_EVENTS = 0x1d; Event.GetEventName = function(eventId) { switch(eventId) { case 0x1 : return 'component_created'; - case 0x2 : return 'create_instance_before'; - case 0x3 : return 'dispose_instance'; - case 0x4 : return 'dispose_object'; - case 0x5 : return 'get_runtime'; - case 0x6 : return 'get_window_size'; - case 0x7 : return 'input_component_initialized'; - case 0x8 : return 'instance_created'; - case 0x9 : return 'instance_disposed'; - case 0xa : return 'keyboard_down'; - case 0xb : return 'keyboard_up'; - case 0xc : return 'mouse_down'; - case 0xd : return 'mouse_move'; - case 0xe : return 'mouse_up'; - case 0xf : return 'mouse_wheel'; - case 0x10 : return 'object_created'; - case 0x11 : return 'object_initialized'; - case 0x12 : return 'pause'; - case 0x13 : return 'restart'; - case 0x14 : return 'start'; - case 0x15 : return 'touch_cancel'; - case 0x16 : return 'touch_end'; - case 0x17 : return 'touch_move'; - case 0x18 : return 'touch_start'; - case 0x19 : return 'update_from_instance_after'; - case 0x1a : return 'update_from_instance_before'; + 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 'get_runtime'; + case 0x8 : return 'get_window_size'; + case 0x9 : return 'input_component_initialized'; + case 0xa : return 'instance_created'; + case 0xb : return 'instance_disposed'; + case 0xc : return 'keyboard_down'; + case 0xd : return 'keyboard_up'; + case 0xe : return 'mouse_down'; + case 0xf : return 'mouse_move'; + case 0x10 : return 'mouse_up'; + case 0x11 : return 'mouse_wheel'; + case 0x12 : return 'object_created'; + case 0x13 : return 'object_initialized'; + case 0x14 : return 'pause'; + case 0x15 : return 'restart'; + case 0x16 : return 'start'; + case 0x17 : return 'touch_cancel'; + case 0x18 : return 'touch_end'; + case 0x19 : return 'touch_move'; + case 0x1a : return 'touch_start'; + case 0x1b : return 'update_from_instance_after'; + case 0x1c : return 'update_from_instance_before'; default : throw new Error('Event type not defined : ' + eventId); } @@ -376,8 +379,7 @@ class Utils { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -1616,6 +1618,125 @@ class Utils { } +/** + + Class R3.System.DOM + [Inherited from System] + + Inherited Properties: + + - started (Default value false) + - subscriptions (Default value {}) + + Inherited Static Properties: + + - Started (Default value false) + - Subscriptions (Default value {}) + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to SystemDOM] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + - Start() + Starts the system by registering subscriptions to events + + - Stop() + Stops the system by removing these subscriptions to events + + **/ + +class SystemDOM extends System { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + Object.assign(this, options); + + if (options.callDepth === 0) { + this.initialized(); + } else { + options.callDepth--; + } + + } + + /** + * Start() + * - Starts the system by registering subscriptions to events + */ + static Start() { + + SystemDOM.Subscriptions['DOM_COMPONENT_INITIALIZED'] = Event.Subscribe( + Event.DOM_COMPONENT_INITIALIZED, + SystemDOM.OnDomComponentInitialized + ); + + SystemDOM.Started = true; + + console.log('Started system: SystemDOM'); + + } + + /** + * Stop() + * - Stops the system by removing these subscriptions to events + */ + static Stop() { + + SystemDOM.Subscriptions['DOM_COMPONENT_INITIALIZED'].remove(); + delete SystemDOM.Subscriptions['DOM_COMPONENT_INITIALIZED']; + + SystemDOM.Started = false; + + console.log('Stopped system: SystemDOM'); + + } + + /** + * OnDomComponentInitialized() + * - 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 + */ + static OnDomComponentInitialized(object) { + + console.log('DOM Component Created'); + + } + +} + /** Class R3.System.Input @@ -1686,8 +1807,7 @@ class SystemInput extends System { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -1996,8 +2116,7 @@ class SystemLinking extends System { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -2088,7 +2207,7 @@ class SystemLinking extends System { */ static OnObjectCreated(object) { - console.log('Object Created : ' + object.name); + console.log('Object Created'); } @@ -2186,8 +2305,7 @@ class SystemSocket extends System { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -2233,8 +2351,6 @@ class SystemSocket extends System { console.log('Started system: SystemSocket'); - console.log('CUSTOM Start Test Stuff'); - } /** @@ -2330,8 +2446,7 @@ class Runtime extends Event { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -2407,7 +2522,8 @@ Runtime.MAX_RUNTIMES = 0xc; Methods: - + - initialized() + Emits an event which indicates that this object instance is ready to be created Static Methods: @@ -2446,14 +2562,24 @@ class R3Object extends Event { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } } + /** + * initialized() + * - Emits an event which indicates that this object instance is ready to be created + */ + initialized() { + + Event.Emit(Event.OBJECT_INITIALIZED, this); + delete this.callDepth; + + } + } /** @@ -2552,8 +2678,7 @@ class Coder extends Runtime { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -2658,8 +2783,7 @@ class Default extends Runtime { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -2764,8 +2888,7 @@ class GUI extends Runtime { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -2870,8 +2993,7 @@ class Graphics extends Runtime { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -2976,8 +3098,7 @@ class Physics extends Runtime { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -3082,8 +3203,7 @@ class Socket extends Runtime { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -3188,8 +3308,7 @@ class Statistics extends Runtime { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -3251,7 +3370,8 @@ class Statistics extends Runtime { Inherited Methods: - + - initialized() + Emits an event which indicates that this object instance is ready to be created Inherited Static Methods: @@ -3269,6 +3389,9 @@ class Statistics extends Runtime { Methods: + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + - createInstance() Creates an instance of this object based on the current runtime @@ -3309,8 +3432,7 @@ class Component extends R3Object { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -3318,6 +3440,19 @@ class Component extends R3Object { this.emit(Event.COMPONENT_CREATED, this); } + /** + * initialized() + * - In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + */ + initialized() { + + Event.Emit(Event.OBJECT_INITIALIZED, this); + delete this.callDepth; + + Event.Emit(Event.COMPONENT_INITIALIZED, this); + + } + /** * createInstance() * - Creates an instance of this object based on the current runtime @@ -3455,7 +3590,8 @@ Component.MAX_COMPONENTS = 0x5; Inherited Methods: - + - initialized() + Emits an event which indicates that this object instance is ready to be created Inherited Static Methods: @@ -3500,8 +3636,7 @@ class Project extends R3Object { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -3624,8 +3759,7 @@ class CodeMirror extends Coder { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -3748,8 +3882,7 @@ class ControlKit extends GUI { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -3872,8 +4005,7 @@ class Three extends Graphics { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -3996,8 +4128,7 @@ class Bullet extends Physics { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -4120,8 +4251,7 @@ class Stats extends Statistics { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -4183,7 +4313,8 @@ class Stats extends Statistics { Inherited Methods: - + - initialized() + Emits an event which indicates that this object instance is ready to be created Inherited Static Methods: @@ -4201,6 +4332,9 @@ class Stats extends Statistics { Inherited Methods: + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + - createInstance() Creates an instance of this object based on the current runtime @@ -4232,7 +4366,9 @@ class Stats extends Statistics { Methods: - + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + Event.DOM_COMPONENT_INITIALIZED Static Methods: @@ -4259,14 +4395,28 @@ class DOM extends Component { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } } + /** + * initialized() + * - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + * Event.DOM_COMPONENT_INITIALIZED + */ + initialized() { + + Event.Emit(Event.OBJECT_INITIALIZED, this); + delete this.callDepth; + + Event.Emit(Event.COMPONENT_INITIALIZED, this); + Event.Emit(Event.DOM_COMPONENT_INITIALIZED, this); + + } + } /** @@ -4322,7 +4472,8 @@ class DOM extends Component { Inherited Methods: - + - initialized() + Emits an event which indicates that this object instance is ready to be created Inherited Static Methods: @@ -4340,6 +4491,9 @@ class DOM extends Component { Inherited Methods: + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + - createInstance() Creates an instance of this object based on the current runtime @@ -4398,8 +4552,7 @@ class Image extends Component { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -4461,7 +4614,8 @@ class Image extends Component { Inherited Methods: - + - initialized() + Emits an event which indicates that this object instance is ready to be created Inherited Static Methods: @@ -4479,6 +4633,9 @@ class Image extends Component { Inherited Methods: + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + - createInstance() Creates an instance of this object based on the current runtime @@ -4537,8 +4694,7 @@ class Input extends Component { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -4601,7 +4757,8 @@ class Input extends Component { Inherited Methods: - + - initialized() + Emits an event which indicates that this object instance is ready to be created Inherited Static Methods: @@ -4619,6 +4776,9 @@ class Input extends Component { Inherited Methods: + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + - createInstance() Creates an instance of this object based on the current runtime @@ -4650,7 +4810,9 @@ class Input extends Component { Inherited Methods: - + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + Event.DOM_COMPONENT_INITIALIZED Inherited Static Methods: @@ -4695,8 +4857,7 @@ class Canvas extends DOM { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -4758,7 +4919,8 @@ class Canvas extends DOM { Inherited Methods: - + - initialized() + Emits an event which indicates that this object instance is ready to be created Inherited Static Methods: @@ -4776,6 +4938,9 @@ class Canvas extends DOM { Inherited Methods: + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + - createInstance() Creates an instance of this object based on the current runtime @@ -4852,8 +5017,7 @@ class Touch extends Input { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -4874,6 +5038,7 @@ R3.Canvas = Canvas; R3.Image = Image; R3.Input = Input; R3.Touch = Touch; +System.DOM = SystemDOM; System.Input = SystemInput; System.Linking = SystemLinking; System.Socket = SystemSocket; @@ -4895,6 +5060,7 @@ Runtime.Socket = Socket; Runtime.Statistics = Statistics; Runtime.Statistics.Stats = Stats; console.log('r3.js - version ' + R3.version + ' compiled ' + R3.compileDate); +R3.System.DOM.Start(); R3.System.Input.Start(); R3.System.Linking.Start(); R3.System.Socket.Start(); diff --git a/package.json b/package.json index 7dd64b3..c371609 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "r3", - "version" : "2.0.212", + "version" : "2.0.221", "description": "", "private": true, "dependencies": { diff --git a/src/r3/index.js b/src/r3/index.js index fc303e3..4f63b30 100644 --- a/src/r3/index.js +++ b/src/r3/index.js @@ -4,6 +4,7 @@ const R3 = require('r3-r3.js'); //GENERATED_INDEX_BODY_START console.log('r3.js - version ' + R3.version + ' compiled ' + R3.compileDate); +R3.System.DOM.Start(); R3.System.Input.Start(); R3.System.Linking.Start(); R3.System.Socket.Start(); diff --git a/src/r3/r3-component/r3-canvas.js b/src/r3/r3-component/r3-canvas.js index d04a8eb..582e6aa 100644 --- a/src/r3/r3-component/r3-canvas.js +++ b/src/r3/r3-component/r3-canvas.js @@ -57,7 +57,8 @@ const DOM = require('.././r3-d-o-m.js'); Inherited Methods: - + - initialized() + Emits an event which indicates that this object instance is ready to be created Inherited Static Methods: @@ -75,6 +76,9 @@ const DOM = require('.././r3-d-o-m.js'); Inherited Methods: + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + - createInstance() Creates an instance of this object based on the current runtime @@ -106,7 +110,9 @@ const DOM = require('.././r3-d-o-m.js'); Inherited Methods: - + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + Event.DOM_COMPONENT_INITIALIZED Inherited Static Methods: @@ -181,8 +187,7 @@ class Canvas extends DOM { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-component/r3-component.js b/src/r3/r3-component/r3-component.js index 679633a..98086e6 100644 --- a/src/r3/r3-component/r3-component.js +++ b/src/r3/r3-component/r3-component.js @@ -57,7 +57,8 @@ const R3Object = require('.././r3-r3-object.js'); Inherited Methods: - + - initialized() + Emits an event which indicates that this object instance is ready to be created Inherited Static Methods: @@ -75,6 +76,9 @@ const R3Object = require('.././r3-r3-object.js'); Methods: + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + - createInstance() Creates an instance of this object based on the current runtime @@ -109,11 +113,12 @@ const R3Object = require('.././r3-r3-object.js'); CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_METHODS_START - createInstance() - Creates an instance of this object based on the current runtime - dispose() - Disposes of this object by disposing the instance first. - disposeInstance() - Disposes of the runtime instance. - updateFromInstance() - Updates this object by copying the values of its instance into the current object. - getRuntime() - Gets the current runtime object + initialized() - In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + createInstance() - Creates an instance of this object based on the current runtime + dispose() - Disposes of this object by disposing the instance first. + disposeInstance() - Disposes of the runtime instance. + updateFromInstance() - Updates this object by copying the values of its instance into the current object. + getRuntime() - Gets the current runtime object CUSTOM_METHODS_END CUSTOM_STATIC_METHODS_START @@ -150,8 +155,7 @@ class Component extends R3Object { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -164,6 +168,23 @@ class Component extends R3Object { //GENERATED_METHODS_START + /** + * initialized() + * - In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + */ + initialized() { + + //GENERATED_INITIALIZED_METHOD_START + Event.Emit(Event.OBJECT_INITIALIZED, this); + delete this.callDepth; + //GENERATED_INITIALIZED_METHOD_END + + //CUSTOM_INITIALIZED_METHOD_START + Event.Emit(Event.COMPONENT_INITIALIZED, this); + //CUSTOM_INITIALIZED_METHOD_END + + } + /** * createInstance() * - Creates an instance of this object based on the current runtime diff --git a/src/r3/r3-component/r3-d-o-m.js b/src/r3/r3-component/r3-d-o-m.js index 991d2b1..cb53742 100644 --- a/src/r3/r3-component/r3-d-o-m.js +++ b/src/r3/r3-component/r3-d-o-m.js @@ -57,7 +57,8 @@ const Component = require('.././r3-component.js'); Inherited Methods: - + - initialized() + Emits an event which indicates that this object instance is ready to be created Inherited Static Methods: @@ -75,6 +76,9 @@ const Component = require('.././r3-component.js'); Inherited Methods: + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + - createInstance() Creates an instance of this object based on the current runtime @@ -106,7 +110,9 @@ const Component = require('.././r3-component.js'); Methods: - + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + Event.DOM_COMPONENT_INITIALIZED Static Methods: @@ -127,6 +133,7 @@ const Component = require('.././r3-component.js'); CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_METHODS_START + initialized() - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an Event.DOM_COMPONENT_INITIALIZED CUSTOM_METHODS_END CUSTOM_STATIC_METHODS_START @@ -163,8 +170,7 @@ class DOM extends Component { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -175,6 +181,25 @@ class DOM extends Component { //GENERATED_CONSTRUCTOR_EXTENDS_END //GENERATED_METHODS_START + + /** + * initialized() + * - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + * Event.DOM_COMPONENT_INITIALIZED + */ + initialized() { + + //GENERATED_INITIALIZED_METHOD_START + Event.Emit(Event.OBJECT_INITIALIZED, this); + delete this.callDepth; + //GENERATED_INITIALIZED_METHOD_END + + //CUSTOM_INITIALIZED_METHOD_START + Event.Emit(Event.COMPONENT_INITIALIZED, this); + Event.Emit(Event.DOM_COMPONENT_INITIALIZED, this); + //CUSTOM_INITIALIZED_METHOD_END + + } //GENERATED_METHODS_END //GENERATED_STATIC_METHODS_START diff --git a/src/r3/r3-component/r3-image.js b/src/r3/r3-component/r3-image.js index 2fffcfb..09b3c7b 100644 --- a/src/r3/r3-component/r3-image.js +++ b/src/r3/r3-component/r3-image.js @@ -57,7 +57,8 @@ const Component = require('.././r3-component.js'); Inherited Methods: - + - initialized() + Emits an event which indicates that this object instance is ready to be created Inherited Static Methods: @@ -75,6 +76,9 @@ const Component = require('.././r3-component.js'); Inherited Methods: + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + - createInstance() Creates an instance of this object based on the current runtime @@ -163,8 +167,7 @@ class Image extends Component { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-component/r3-input.js b/src/r3/r3-component/r3-input.js index be73a37..d06e6c8 100644 --- a/src/r3/r3-component/r3-input.js +++ b/src/r3/r3-component/r3-input.js @@ -57,7 +57,8 @@ const Component = require('.././r3-component.js'); Inherited Methods: - + - initialized() + Emits an event which indicates that this object instance is ready to be created Inherited Static Methods: @@ -75,6 +76,9 @@ const Component = require('.././r3-component.js'); Inherited Methods: + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + - createInstance() Creates an instance of this object based on the current runtime @@ -163,8 +167,7 @@ class Input extends Component { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-component/r3-touch.js b/src/r3/r3-component/r3-touch.js index a0407d2..155b0e0 100644 --- a/src/r3/r3-component/r3-touch.js +++ b/src/r3/r3-component/r3-touch.js @@ -57,7 +57,8 @@ const Input = require('.././r3-input.js'); Inherited Methods: - + - initialized() + Emits an event which indicates that this object instance is ready to be created Inherited Static Methods: @@ -75,6 +76,9 @@ const Input = require('.././r3-input.js'); Inherited Methods: + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + - createInstance() Creates an instance of this object based on the current runtime @@ -181,8 +185,7 @@ class Touch extends Input { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-event.js b/src/r3/r3-event.js index 0ef2975..a312604 100644 --- a/src/r3/r3-event.js +++ b/src/r3/r3-event.js @@ -52,8 +52,7 @@ class Event { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -322,62 +321,66 @@ class Event { //GENERATED_EVENTS_START Event.COMPONENT_CREATED = 0x1; -Event.CREATE_INSTANCE_BEFORE = 0x2; -Event.DISPOSE_INSTANCE = 0x3; -Event.DISPOSE_OBJECT = 0x4; -Event.GET_RUNTIME = 0x5; -Event.GET_WINDOW_SIZE = 0x6; -Event.INPUT_COMPONENT_INITIALIZED = 0x7; -Event.INSTANCE_CREATED = 0x8; -Event.INSTANCE_DISPOSED = 0x9; -Event.KEYBOARD_DOWN = 0xa; -Event.KEYBOARD_UP = 0xb; -Event.MOUSE_DOWN = 0xc; -Event.MOUSE_MOVE = 0xd; -Event.MOUSE_UP = 0xe; -Event.MOUSE_WHEEL = 0xf; -Event.OBJECT_CREATED = 0x10; -Event.OBJECT_INITIALIZED = 0x11; -Event.PAUSE = 0x12; -Event.RESTART = 0x13; -Event.START = 0x14; -Event.TOUCH_CANCEL = 0x15; -Event.TOUCH_END = 0x16; -Event.TOUCH_MOVE = 0x17; -Event.TOUCH_START = 0x18; -Event.UPDATE_FROM_INSTANCE_AFTER = 0x19; -Event.UPDATE_FROM_INSTANCE_BEFORE = 0x1a; -Event.MAX_EVENTS = 0x1b; +Event.COMPONENT_INITIALIZED = 0x2; +Event.CREATE_INSTANCE_BEFORE = 0x3; +Event.DISPOSE_INSTANCE = 0x4; +Event.DISPOSE_OBJECT = 0x5; +Event.DOM_COMPONENT_INITIALIZED = 0x6; +Event.GET_RUNTIME = 0x7; +Event.GET_WINDOW_SIZE = 0x8; +Event.INPUT_COMPONENT_INITIALIZED = 0x9; +Event.INSTANCE_CREATED = 0xa; +Event.INSTANCE_DISPOSED = 0xb; +Event.KEYBOARD_DOWN = 0xc; +Event.KEYBOARD_UP = 0xd; +Event.MOUSE_DOWN = 0xe; +Event.MOUSE_MOVE = 0xf; +Event.MOUSE_UP = 0x10; +Event.MOUSE_WHEEL = 0x11; +Event.OBJECT_CREATED = 0x12; +Event.OBJECT_INITIALIZED = 0x13; +Event.PAUSE = 0x14; +Event.RESTART = 0x15; +Event.START = 0x16; +Event.TOUCH_CANCEL = 0x17; +Event.TOUCH_END = 0x18; +Event.TOUCH_MOVE = 0x19; +Event.TOUCH_START = 0x1a; +Event.UPDATE_FROM_INSTANCE_AFTER = 0x1b; +Event.UPDATE_FROM_INSTANCE_BEFORE = 0x1c; +Event.MAX_EVENTS = 0x1d; Event.GetEventName = function(eventId) { switch(eventId) { case 0x1 : return 'component_created'; - case 0x2 : return 'create_instance_before'; - case 0x3 : return 'dispose_instance'; - case 0x4 : return 'dispose_object'; - case 0x5 : return 'get_runtime'; - case 0x6 : return 'get_window_size'; - case 0x7 : return 'input_component_initialized'; - case 0x8 : return 'instance_created'; - case 0x9 : return 'instance_disposed'; - case 0xa : return 'keyboard_down'; - case 0xb : return 'keyboard_up'; - case 0xc : return 'mouse_down'; - case 0xd : return 'mouse_move'; - case 0xe : return 'mouse_up'; - case 0xf : return 'mouse_wheel'; - case 0x10 : return 'object_created'; - case 0x11 : return 'object_initialized'; - case 0x12 : return 'pause'; - case 0x13 : return 'restart'; - case 0x14 : return 'start'; - case 0x15 : return 'touch_cancel'; - case 0x16 : return 'touch_end'; - case 0x17 : return 'touch_move'; - case 0x18 : return 'touch_start'; - case 0x19 : return 'update_from_instance_after'; - case 0x1a : return 'update_from_instance_before'; + 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 'get_runtime'; + case 0x8 : return 'get_window_size'; + case 0x9 : return 'input_component_initialized'; + case 0xa : return 'instance_created'; + case 0xb : return 'instance_disposed'; + case 0xc : return 'keyboard_down'; + case 0xd : return 'keyboard_up'; + case 0xe : return 'mouse_down'; + case 0xf : return 'mouse_move'; + case 0x10 : return 'mouse_up'; + case 0x11 : return 'mouse_wheel'; + case 0x12 : return 'object_created'; + case 0x13 : return 'object_initialized'; + case 0x14 : return 'pause'; + case 0x15 : return 'restart'; + case 0x16 : return 'start'; + case 0x17 : return 'touch_cancel'; + case 0x18 : return 'touch_end'; + case 0x19 : return 'touch_move'; + case 0x1a : return 'touch_start'; + case 0x1b : return 'update_from_instance_after'; + case 0x1c : return 'update_from_instance_before'; default : throw new Error('Event type not defined : ' + eventId); } diff --git a/src/r3/r3-project.js b/src/r3/r3-project.js index bc9bee6..c283e5b 100644 --- a/src/r3/r3-project.js +++ b/src/r3/r3-project.js @@ -57,7 +57,8 @@ const R3Object = require('./r3-r3-object.js'); Inherited Methods: - + - initialized() + Emits an event which indicates that this object instance is ready to be created Inherited Static Methods: @@ -132,8 +133,7 @@ class Project extends R3Object { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-r3-object.js b/src/r3/r3-r3-object.js index 596db5e..056dfca 100644 --- a/src/r3/r3-r3-object.js +++ b/src/r3/r3-r3-object.js @@ -56,7 +56,8 @@ const Event = require('./r3-event.js'); Methods: - + - initialized() + Emits an event which indicates that this object instance is ready to be created Static Methods: @@ -80,6 +81,7 @@ const Event = require('./r3-event.js'); CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_METHODS_START + initialized() - Emits an event which indicates that this object instance is ready to be created CUSTOM_METHODS_END CUSTOM_STATIC_METHODS_START @@ -128,8 +130,7 @@ class R3Object extends Event { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -140,6 +141,22 @@ class R3Object extends Event { //GENERATED_CONSTRUCTOR_EXTENDS_END //GENERATED_METHODS_START + + /** + * initialized() + * - Emits an event which indicates that this object instance is ready to be created + */ + initialized() { + + //GENERATED_INITIALIZED_METHOD_START + Event.Emit(Event.OBJECT_INITIALIZED, this); + delete this.callDepth; + //GENERATED_INITIALIZED_METHOD_END + + //CUSTOM_INITIALIZED_METHOD_START + //CUSTOM_INITIALIZED_METHOD_END + + } //GENERATED_METHODS_END //GENERATED_STATIC_METHODS_START diff --git a/src/r3/r3-r3.js b/src/r3/r3-r3.js index 1bfcb06..1eaef2b 100644 --- a/src/r3/r3-r3.js +++ b/src/r3/r3-r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.212'; - static compileDate = '2021 Sep 08 - 08:24:42 am'; + static version = '2.0.221'; + static compileDate = '2021 Sep 08 - 08:46:07 am'; } //GENERATED_IMPORTS_START diff --git a/src/r3/r3-runtime/r3-bullet.js b/src/r3/r3-runtime/r3-bullet.js index 6a0a003..24ee027 100644 --- a/src/r3/r3-runtime/r3-bullet.js +++ b/src/r3/r3-runtime/r3-bullet.js @@ -148,8 +148,7 @@ class Bullet extends Physics { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-code-mirror.js b/src/r3/r3-runtime/r3-code-mirror.js index b544e20..56a8358 100644 --- a/src/r3/r3-runtime/r3-code-mirror.js +++ b/src/r3/r3-runtime/r3-code-mirror.js @@ -148,8 +148,7 @@ class CodeMirror extends Coder { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-coder.js b/src/r3/r3-runtime/r3-coder.js index c7089d4..8c903e5 100644 --- a/src/r3/r3-runtime/r3-coder.js +++ b/src/r3/r3-runtime/r3-coder.js @@ -130,8 +130,7 @@ class Coder extends Runtime { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-control-kit.js b/src/r3/r3-runtime/r3-control-kit.js index 6011953..13e92a0 100644 --- a/src/r3/r3-runtime/r3-control-kit.js +++ b/src/r3/r3-runtime/r3-control-kit.js @@ -148,8 +148,7 @@ class ControlKit extends GUI { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-default.js b/src/r3/r3-runtime/r3-default.js index 3e03554..6717408 100644 --- a/src/r3/r3-runtime/r3-default.js +++ b/src/r3/r3-runtime/r3-default.js @@ -130,8 +130,7 @@ class Default extends Runtime { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-g-u-i.js b/src/r3/r3-runtime/r3-g-u-i.js index 167fdaa..0cc3f7d 100644 --- a/src/r3/r3-runtime/r3-g-u-i.js +++ b/src/r3/r3-runtime/r3-g-u-i.js @@ -130,8 +130,7 @@ class GUI extends Runtime { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-graphics.js b/src/r3/r3-runtime/r3-graphics.js index 3c15b43..786517b 100644 --- a/src/r3/r3-runtime/r3-graphics.js +++ b/src/r3/r3-runtime/r3-graphics.js @@ -130,8 +130,7 @@ class Graphics extends Runtime { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-physics.js b/src/r3/r3-runtime/r3-physics.js index 46251ee..ff6efff 100644 --- a/src/r3/r3-runtime/r3-physics.js +++ b/src/r3/r3-runtime/r3-physics.js @@ -130,8 +130,7 @@ class Physics extends Runtime { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-runtime.js b/src/r3/r3-runtime/r3-runtime.js index 7641627..0c055a6 100644 --- a/src/r3/r3-runtime/r3-runtime.js +++ b/src/r3/r3-runtime/r3-runtime.js @@ -111,8 +111,7 @@ class Runtime extends Event { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-socket.js b/src/r3/r3-runtime/r3-socket.js index 711482b..f72da40 100644 --- a/src/r3/r3-runtime/r3-socket.js +++ b/src/r3/r3-runtime/r3-socket.js @@ -130,8 +130,7 @@ class Socket extends Runtime { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-statistics.js b/src/r3/r3-runtime/r3-statistics.js index cd5117b..2814066 100644 --- a/src/r3/r3-runtime/r3-statistics.js +++ b/src/r3/r3-runtime/r3-statistics.js @@ -130,8 +130,7 @@ class Statistics extends Runtime { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-stats.js b/src/r3/r3-runtime/r3-stats.js index 16068cd..3f21e84 100644 --- a/src/r3/r3-runtime/r3-stats.js +++ b/src/r3/r3-runtime/r3-stats.js @@ -148,8 +148,7 @@ class Stats extends Statistics { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-three.js b/src/r3/r3-runtime/r3-three.js index 2ed1f99..e3a1955 100644 --- a/src/r3/r3-runtime/r3-three.js +++ b/src/r3/r3-runtime/r3-three.js @@ -148,8 +148,7 @@ class Three extends Graphics { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-system/index.js b/src/r3/r3-system/index.js index 8994c1b..ba58a1b 100644 --- a/src/r3/r3-system/index.js +++ b/src/r3/r3-system/index.js @@ -1,11 +1,13 @@ //GENERATED_IMPORTS_START const System = require('./r3-system.js'); +const SystemDOM = require('./r3-system-d-o-m.js'); const SystemInput = require('./r3-system-input.js'); const SystemLinking = require('./r3-system-linking.js'); const SystemSocket = require('./r3-system-socket.js'); //GENERATED_IMPORTS_END //GENERATED_INDEX_BODY_START +System.DOM = SystemDOM; System.Input = SystemInput; System.Linking = SystemLinking; System.Socket = SystemSocket; diff --git a/src/r3/r3-system/r3-system-d-o-m.js b/src/r3/r3-system/r3-system-d-o-m.js new file mode 100644 index 0000000..23a238c --- /dev/null +++ b/src/r3/r3-system/r3-system-d-o-m.js @@ -0,0 +1,217 @@ +const Event = require('.././r3-event'); +const Utils = require('.././r3-utils'); +const System = require('./r3-system.js'); + +/** + + GENERATED_INHERITED_START + + Class R3.System.DOM + [Inherited from System] + + Inherited Properties: + + - started (Default value false) + - subscriptions (Default value {}) + + Inherited Static Properties: + + - Started (Default value false) + - Subscriptions (Default value {}) + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to SystemDOM] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + - Start() + Starts the system by registering subscriptions to events + + - Stop() + Stops the system by removing these subscriptions to events + + GENERATED_INHERITED_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + CUSTOM_STATIC_OPTIONS_START + CUSTOM_STATIC_OPTIONS_END + + CUSTOM_EVENT_LISTENERS_START + CUSTOM_EVENT_LISTENERS_END + + CUSTOM_STATIC_EVENT_LISTENERS_START + Event.DOM_COMPONENT_INITIALIZED + CUSTOM_STATIC_EVENT_LISTENERS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + CUSTOM_STATIC_METHODS_START + Start() - Starts the system by registering subscriptions to events + Stop() - Stops the system by removing these subscriptions to events + CUSTOM_STATIC_METHODS_END + + **/ + +class SystemDOM extends System { + + //GENERATED_CONSTRUCTOR_EXTENDS_START + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END + + //CUSTOM_OPTIONS_INIT_START + //CUSTOM_OPTIONS_INIT_END + + Object.assign(this, options); + + //CUSTOM_BEFORE_INIT_START + //CUSTOM_BEFORE_INIT_END + + if (options.callDepth === 0) { + this.initialized(); + } else { + options.callDepth--; + } + + //CUSTOM_AFTER_INIT_START + //CUSTOM_AFTER_INIT_END + } + //GENERATED_CONSTRUCTOR_EXTENDS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_STATIC_METHODS_START + + /** + * Start() + * - Starts the system by registering subscriptions to events + */ + static Start() { + + //GENERATED_STATIC_START_METHOD_START + + //GENERATED_STATIC_EVENT_LISTENERS_START_START + SystemDOM.Subscriptions['DOM_COMPONENT_INITIALIZED'] = Event.Subscribe( + Event.DOM_COMPONENT_INITIALIZED, + SystemDOM.OnDomComponentInitialized + ); + + //GENERATED_STATIC_EVENT_LISTENERS_START_END + + //CUSTOM_BEFORE_STATIC_SYSTEM_START_START + //CUSTOM_BEFORE_STATIC_SYSTEM_START_END + + SystemDOM.Started = true; + + console.log('Started system: SystemDOM'); + + //GENERATED_STATIC_START_METHOD_END + + //CUSTOM_STATIC_START_METHOD_START + //CUSTOM_STATIC_START_METHOD_END + + } + + /** + * Stop() + * - Stops the system by removing these subscriptions to events + */ + static Stop() { + + //GENERATED_STATIC_STOP_METHOD_START + + //GENERATED_STATIC_EVENT_LISTENERS_STOP_START + SystemDOM.Subscriptions['DOM_COMPONENT_INITIALIZED'].remove(); + delete SystemDOM.Subscriptions['DOM_COMPONENT_INITIALIZED']; + + //GENERATED_STATIC_EVENT_LISTENERS_STOP_END + + //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_START + //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_END + + SystemDOM.Started = false; + + console.log('Stopped system: SystemDOM'); + + //GENERATED_STATIC_STOP_METHOD_END + + //CUSTOM_STATIC_STOP_METHOD_START + //CUSTOM_STATIC_STOP_METHOD_END + + } + //GENERATED_STATIC_METHODS_END + + //GENERATED_EVENT_LISTENER_METHODS_START + //GENERATED_EVENT_LISTENER_METHODS_END + + //GENERATED_STATIC_EVENT_LISTENER_METHODS_START + + /** + * OnDomComponentInitialized() + * - 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 + */ + static OnDomComponentInitialized(object) { + + //GENERATED_STATIC_ON_DOM_COMPONENT_INITIALIZED_METHOD_START + //GENERATED_STATIC_ON_DOM_COMPONENT_INITIALIZED_METHOD_END + + //CUSTOM_STATIC_ON_DOM_COMPONENT_INITIALIZED_METHOD_START + console.log('DOM Component Created'); + //CUSTOM_STATIC_ON_DOM_COMPONENT_INITIALIZED_METHOD_END + + } + //GENERATED_STATIC_EVENT_LISTENER_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END + +} + +//GENERATED_STATIC_OPTIONS_INIT_START +//GENERATED_STATIC_OPTIONS_INIT_END + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END + +module.exports = SystemDOM; diff --git a/src/r3/r3-system/r3-system-input.js b/src/r3/r3-system/r3-system-input.js index 7e09531..89c69d1 100644 --- a/src/r3/r3-system/r3-system-input.js +++ b/src/r3/r3-system/r3-system-input.js @@ -118,8 +118,7 @@ class SystemInput extends System { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/r3/r3-system/r3-system-linking.js b/src/r3/r3-system/r3-system-linking.js index cb6ceaf..8e95c79 100644 --- a/src/r3/r3-system/r3-system-linking.js +++ b/src/r3/r3-system/r3-system-linking.js @@ -111,8 +111,7 @@ class SystemLinking extends System { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -271,7 +270,7 @@ class SystemLinking extends System { //GENERATED_STATIC_ON_OBJECT_CREATED_METHOD_END //CUSTOM_STATIC_ON_OBJECT_CREATED_METHOD_START - console.log('Object Created : ' + object.name); + console.log('Object Created'); //CUSTOM_STATIC_ON_OBJECT_CREATED_METHOD_END } diff --git a/src/r3/r3-system/r3-system-socket.js b/src/r3/r3-system/r3-system-socket.js index 558dd77..9489168 100644 --- a/src/r3/r3-system/r3-system-socket.js +++ b/src/r3/r3-system/r3-system-socket.js @@ -108,8 +108,7 @@ class SystemSocket extends System { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -198,7 +197,6 @@ class SystemSocket extends System { //GENERATED_STATIC_START_METHOD_END //CUSTOM_STATIC_START_METHOD_START - console.log('CUSTOM Start Test Stuff'); //CUSTOM_STATIC_START_METHOD_END } diff --git a/src/r3/r3-system/r3-system.js b/src/r3/r3-system/r3-system.js index a9c2a0a..d7c3a68 100644 --- a/src/r3/r3-system/r3-system.js +++ b/src/r3/r3-system/r3-system.js @@ -64,8 +64,7 @@ class System { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } @@ -98,10 +97,11 @@ System.Subscriptions = {}; //GENERATED_STATIC_OPTIONS_INIT_END //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START -System.SYSTEM_INPUT = 0x0; -System.SYSTEM_LINKING = 0x1; -System.SYSTEM_SOCKET = 0x2; -System.MAX_SYSTEMS = 0x3; +System.SYSTEM_DOM = 0x0; +System.SYSTEM_INPUT = 0x1; +System.SYSTEM_LINKING = 0x2; +System.SYSTEM_SOCKET = 0x3; +System.MAX_SYSTEMS = 0x4; //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START diff --git a/src/r3/r3-utils.js b/src/r3/r3-utils.js index b561d7a..95a8501 100644 --- a/src/r3/r3-utils.js +++ b/src/r3/r3-utils.js @@ -46,8 +46,7 @@ class Utils { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/templates/constructor.template b/src/templates/constructor.template index 59880cc..9019fdd 100644 --- a/src/templates/constructor.template +++ b/src/templates/constructor.template @@ -24,8 +24,7 @@ //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/templates/constructor_extends.template b/src/templates/constructor_extends.template index 1c8c21b..8e0d2ec 100644 --- a/src/templates/constructor_extends.template +++ b/src/templates/constructor_extends.template @@ -24,8 +24,7 @@ //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + this.initialized(); } else { options.callDepth--; } diff --git a/src/templates/initialized.template b/src/templates/initialized.template new file mode 100644 index 0000000..36bf010 --- /dev/null +++ b/src/templates/initialized.template @@ -0,0 +1,2 @@ + Event.Emit(Event.OBJECT_INITIALIZED, this); + delete this.callDepth; \ No newline at end of file diff --git a/src/templates/token.db b/src/templates/token.db index f67dcbe..8273253 100644 --- a/src/templates/token.db +++ b/src/templates/token.db @@ -16,6 +16,7 @@ GENERATED_GET_RUNTIME_METHOD GENERATED_IMPORTS GENERATED_INDEX_BODY GENERATED_INHERITED +GENERATED_INITIALIZED_METHOD GENERATED_METHOD_NAME_UPPERCASE_METHOD GENERATED_METHODS GENERATED_OPTIONS_INIT @@ -28,6 +29,7 @@ GENERATED_STATIC_EVENT_LISTENERS_START GENERATED_STATIC_EVENT_LISTENERS_STOP GENERATED_STATIC_METHOD_NAME_UPPERCASE_METHOD GENERATED_STATIC_METHODS +GENERATED_STATIC_ON_DOM_COMPONENT_INITIALIZED_METHOD GENERATED_STATIC_ON_INSTANCE_CREATED_METHOD GENERATED_STATIC_ON_KEYBOARD_DOWN_METHOD GENERATED_STATIC_ON_KEYBOARD_UP_METHOD @@ -66,6 +68,7 @@ CUSTOM_EVENT_LISTENERS CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS CUSTOM_GET_RUNTIME_METHOD CUSTOM_IMPLEMENTATION +CUSTOM_INITIALIZED_METHOD CUSTOM_INSTANCE_OPTIONS_MAPPING CUSTOM_LINKED_OBJECTS CUSTOM_METHOD_NAME_UPPERCASE_METHOD @@ -79,6 +82,7 @@ CUSTOM_STATIC_EMIT_METHOD CUSTOM_STATIC_EVENT_LISTENERS CUSTOM_STATIC_METHOD_NAME_UPPERCASE_METHOD CUSTOM_STATIC_METHODS +CUSTOM_STATIC_ON_DOM_COMPONENT_INITIALIZED_METHOD CUSTOM_STATIC_ON_INSTANCE_CREATED_METHOD CUSTOM_STATIC_ON_KEYBOARD_DOWN_METHOD CUSTOM_STATIC_ON_KEYBOARD_UP_METHOD diff --git a/version b/version index 74f7910..7fbdaa8 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.0.212 \ No newline at end of file +2.0.221 \ No newline at end of file