From 6b77cc30672410f4811fafeb83ab344fa872fe8d Mon Sep 17 00:00:00 2001 From: "Theunis J. Botha" Date: Thu, 9 Sep 2021 17:59:33 +0200 Subject: [PATCH] fixed initialized --- .r3_history | 8 +- dist/r3.js | 822 ++++++++---------- package.json | 2 +- src/r3/r3-component/index.js | 2 - src/r3/r3-component/r3-canvas.js | 7 +- src/r3/r3-component/r3-component.js | 26 +- src/r3/r3-component/r3-d-o-m.js | 15 +- src/r3/r3-component/r3-input.js | 36 +- src/r3/r3-component/r3-touch.js | 11 +- src/r3/r3-event.js | 69 +- src/r3/r3-project.js | 29 +- src/r3/r3-r3-object.js | 23 +- src/r3/r3-r3.js | 5 +- src/r3/r3-runtime/index.js | 2 + 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 + .../r3-image.js => r3-runtime/r3-document.js} | 72 +- 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 | 24 +- 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/r3-system-d-o-m.js | 90 +- src/r3/r3-system/r3-system-input.js | 91 +- src/r3/r3-system/r3-system-linking.js | 90 +- src/r3/r3-system/r3-system-socket.js | 91 +- src/r3/r3-system/r3-system.js | 45 - src/r3/r3-utils.js | 20 + src/templates/initialized.template | 7 +- src/templates/normal.template | 1 + src/templates/r3-base.template | 15 - src/templates/system-base.template | 62 -- src/templates/system.template | 70 -- src/templates/token.db | 4 - version | 2 +- 41 files changed, 641 insertions(+), 1136 deletions(-) rename src/r3/{r3-component/r3-image.js => r3-runtime/r3-document.js} (78%) delete mode 100644 src/templates/r3-base.template delete mode 100644 src/templates/system-base.template delete mode 100644 src/templates/system.template diff --git a/.r3_history b/.r3_history index ca9a030..0d1b318 100644 --- a/.r3_history +++ b/.r3_history @@ -1,13 +1,12 @@ -r3 create R3 r3-base +r3 create R3 r3_base r3 create Event normal r3 create R3Object extends Event r3 create Utils normal r3 create Project extends R3Object -r3 create System system-base +r3 create System system_base r3 create SystemSocket system r3 create SystemLinking system -r3 create Component extends R3Object ./r3-component/ -r3 create Image extends Component ./r3-component/ +r3 create Component extends R3Object ./r3-component/ r3 create SystemInput system r3 create Input extends Component ./r3-component/ r3 create Touch extends Input ./r3-component/ @@ -27,3 +26,4 @@ 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 +r3 create Document extends Default ./r3-runtime/ diff --git a/dist/r3.js b/dist/r3.js index d17e3ce..3e37ca5 100644 --- a/dist/r3.js +++ b/dist/r3.js @@ -1,65 +1,22 @@ class R3 { - static version = '2.0.228'; - static compileDate = '2021 Sep 08 - 23:13:48 pm'; + static version = '2.0.448'; + static compileDate = '2021 Sep 09 - 17:56:56 pm'; } -/** - - Started=false - Subscriptions={} - - **/ - class System { constructor(options) { - Event.Emit(Event.OBJECT_CREATED, this); - if (typeof options === 'undefined') { options = {}; } - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - if (typeof options.started === 'undefined') { - options.started = false; - } - - if (typeof options.subscriptions === 'undefined') { - options.subscriptions = {}; - } - Object.assign(this, options); - if (options.callDepth === 0) { - this.initialized(); - } else { - options.callDepth--; - } - - } - - /** - * initialized() - * - No comment - */ - initialized() { - - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; - } } -System.Started = false; -System.Subscriptions = {}; - System.SYSTEM_DOM = 0x0; System.SYSTEM_INPUT = 0x1; System.SYSTEM_LINKING = 0x2; @@ -98,6 +55,22 @@ class Event { */ static Subscriptions = {}; + /** + * initialized() + * - Should raise an event(s) which indicates that this object initialized + */ + initialized() { + + if (this.hasOwnProperty('callDepth')) { + delete this.callDepth; + } else { + console.warn('Multiple calls to initialized() - check your callstack'); + } + + Event.Emit(Event.EVENT_INITIALIZED, this); + + } + /** * async() * - Simply calls 'Async()' passing it the arguments @@ -324,15 +297,16 @@ 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.PROJECT_INITIALIZED = 0x15; +Event.RESTART = 0x16; +Event.START = 0x17; +Event.TOUCH_CANCEL = 0x18; +Event.TOUCH_END = 0x19; +Event.TOUCH_MOVE = 0x1a; +Event.TOUCH_START = 0x1b; +Event.UPDATE_FROM_INSTANCE_AFTER = 0x1c; +Event.UPDATE_FROM_INSTANCE_BEFORE = 0x1d; +Event.MAX_EVENTS = 0x1e; Event.GetEventName = function(eventId) { @@ -357,14 +331,15 @@ Event.GetEventName = function(eventId) { 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'; + case 0x15 : return 'project_initialized'; + case 0x16 : return 'restart'; + case 0x17 : return 'start'; + case 0x18 : return 'touch_cancel'; + case 0x19 : return 'touch_end'; + case 0x1a : return 'touch_move'; + case 0x1b : return 'touch_start'; + case 0x1c : return 'update_from_instance_after'; + case 0x1d : return 'update_from_instance_before'; default : throw new Error('Event type not defined : ' + eventId); } @@ -1627,6 +1602,20 @@ class Utils { return pad.substring(0, pad.length - string.length) + string; }; + /** + * initialized() + * - Should raise an event(s) which indicates that this object initialized + */ + initialized() { + + if (this.hasOwnProperty('callDepth')) { + delete this.callDepth; + } else { + console.warn('Multiple calls to initialized() - check your callstack'); + } + + } + } /** @@ -1636,18 +1625,15 @@ class Utils { Inherited Properties: - - started (Default value false) - - subscriptions (Default value {}) + Inherited Static Properties: - - Started (Default value false) - - Subscriptions (Default value {}) + Inherited Methods: - - initialized() - No comment + Inherited Static Methods: @@ -1657,8 +1643,7 @@ class Utils { Properties: - - started (Default value false) - - subscriptions (Default value {}) + Static Properties: @@ -1667,11 +1652,7 @@ class Utils { Methods: - - start() - Starts a transient system by registering subscriptions to Events - - - stop() - Stops a transient system to by removing subscriptions to Events + Static Methods: @@ -1694,54 +1675,10 @@ class SystemDOM extends System { options = {}; } - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - super(options); - if (typeof options.started === 'undefined') { - options.started = false; - } - - if (typeof options.subscriptions === 'undefined') { - options.subscriptions = {}; - } - Object.assign(this, options); - if (options.callDepth === 0) { - this.initialized(); - } else { - options.callDepth--; - } - - } - - /** - * start() - * - Starts a transient system by registering subscriptions to Events - */ - start() { - - this.started = true; - - console.log('Started transient system: SystemDOM'); - - } - - /** - * stop() - * - Stops a transient system to by removing subscriptions to Events - */ - stop() { - - this.started = false; - - console.log('Stopped transient system: SystemDOM'); - } /** @@ -1802,18 +1739,15 @@ SystemDOM.Subscriptions = {}; Inherited Properties: - - started (Default value false) - - subscriptions (Default value {}) + Inherited Static Properties: - - Started (Default value false) - - Subscriptions (Default value {}) + Inherited Methods: - - initialized() - No comment + Inherited Static Methods: @@ -1823,8 +1757,7 @@ SystemDOM.Subscriptions = {}; Properties: - - started (Default value false) - - subscriptions (Default value {}) + Static Properties: @@ -1833,11 +1766,7 @@ SystemDOM.Subscriptions = {}; Methods: - - start() - Starts a transient system by registering subscriptions to Events - - - stop() - Stops a transient system to by removing subscriptions to Events + Static Methods: @@ -1860,56 +1789,10 @@ class SystemInput extends System { options = {}; } - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - super(options); - if (typeof options.started === 'undefined') { - options.started = false; - } - - if (typeof options.subscriptions === 'undefined') { - options.subscriptions = {}; - } - Object.assign(this, options); - if (options.callDepth === 0) { - this.initialized(); - } else { - options.callDepth--; - } - - } - - /** - * start() - * - Starts a transient system by registering subscriptions to Events - */ - start() { - - console.log('Test for custom start before'); - - this.started = true; - - console.log('Started transient system: SystemInput'); - - } - - /** - * stop() - * - Stops a transient system to by removing subscriptions to Events - */ - stop() { - - this.started = false; - - console.log('Stopped transient system: SystemInput'); - } /** @@ -2128,18 +2011,15 @@ SystemInput.Subscriptions = {}; Inherited Properties: - - started (Default value false) - - subscriptions (Default value {}) + Inherited Static Properties: - - Started (Default value false) - - Subscriptions (Default value {}) + Inherited Methods: - - initialized() - No comment + Inherited Static Methods: @@ -2149,8 +2029,7 @@ SystemInput.Subscriptions = {}; Properties: - - started (Default value false) - - subscriptions (Default value {}) + Static Properties: @@ -2159,11 +2038,7 @@ SystemInput.Subscriptions = {}; Methods: - - start() - Starts a transient system by registering subscriptions to Events - - - stop() - Stops a transient system to by removing subscriptions to Events + Static Methods: @@ -2186,54 +2061,10 @@ class SystemLinking extends System { options = {}; } - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - super(options); - if (typeof options.started === 'undefined') { - options.started = false; - } - - if (typeof options.subscriptions === 'undefined') { - options.subscriptions = {}; - } - Object.assign(this, options); - if (options.callDepth === 0) { - this.initialized(); - } else { - options.callDepth--; - } - - } - - /** - * start() - * - Starts a transient system by registering subscriptions to Events - */ - start() { - - this.started = true; - - console.log('Started transient system: SystemLinking'); - - } - - /** - * stop() - * - Stops a transient system to by removing subscriptions to Events - */ - stop() { - - this.started = false; - - console.log('Stopped transient system: SystemLinking'); - } /** @@ -2332,18 +2163,15 @@ SystemLinking.Subscriptions = {}; Inherited Properties: - - started (Default value false) - - subscriptions (Default value {}) + Inherited Static Properties: - - Started (Default value false) - - Subscriptions (Default value {}) + Inherited Methods: - - initialized() - No comment + Inherited Static Methods: @@ -2353,8 +2181,7 @@ SystemLinking.Subscriptions = {}; Properties: - - started (Default value false) - - subscriptions (Default value {}) + Static Properties: @@ -2363,11 +2190,7 @@ SystemLinking.Subscriptions = {}; Methods: - - start() - Starts a transient system by registering subscriptions to Events - - - stop() - Stops a transient system to by removing subscriptions to Events + Static Methods: @@ -2390,56 +2213,10 @@ class SystemSocket extends System { options = {}; } - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - super(options); - if (typeof options.started === 'undefined') { - options.started = false; - } - - if (typeof options.subscriptions === 'undefined') { - options.subscriptions = {}; - } - Object.assign(this, options); - if (options.callDepth === 0) { - this.initialized(); - } else { - options.callDepth--; - } - - } - - /** - * start() - * - Starts a transient system by registering subscriptions to Events - */ - start() { - - this.started = true; - - console.log('Started transient system: SystemSocket'); - - } - - /** - * stop() - * - Stops a transient system to by removing subscriptions to Events - */ - stop() { - - this.started = false; - - console.log('Stopped transient system: SystemSocket'); - - console.log('system socket stop test'); - } /** @@ -2488,6 +2265,9 @@ SystemSocket.Subscriptions = {}; Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -2563,16 +2343,17 @@ class Runtime extends Event { Runtime.CODER = 0x0; Runtime.CODE_MIRROR = 0x1; Runtime.DEFAULT = 0x2; -Runtime.GUI = 0x3; -Runtime.CONTROL_KIT = 0x4; -Runtime.GRAPHICS = 0x5; -Runtime.THREE = 0x6; -Runtime.PHYSICS = 0x7; -Runtime.BULLET = 0x8; -Runtime.SOCKET = 0x9; -Runtime.STATISTICS = 0xa; -Runtime.STATS = 0xb; -Runtime.MAX_RUNTIMES = 0xc; +Runtime.DOCUMENT = 0x3; +Runtime.GUI = 0x4; +Runtime.CONTROL_KIT = 0x5; +Runtime.GRAPHICS = 0x6; +Runtime.THREE = 0x7; +Runtime.PHYSICS = 0x8; +Runtime.BULLET = 0x9; +Runtime.SOCKET = 0xa; +Runtime.STATISTICS = 0xb; +Runtime.STATS = 0xc; +Runtime.MAX_RUNTIMES = 0xd; /** @@ -2589,6 +2370,9 @@ Runtime.MAX_RUNTIMES = 0xc; Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -2628,7 +2412,7 @@ Runtime.MAX_RUNTIMES = 0xc; Methods: - initialized() - Emits an event which indicates that this object instance is ready to be created + Overrides for R3.Event.initialized() Static Methods: @@ -2676,12 +2460,17 @@ class R3Object extends Event { /** * initialized() - * - Emits an event which indicates that this object instance is ready to be created + * - Should raise an event(s) which indicates that this object initialized */ initialized() { + if (this.hasOwnProperty('callDepth')) { + delete this.callDepth; + } else { + console.warn('Multiple calls to initialized() - check your callstack'); + } + Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; } @@ -2702,6 +2491,9 @@ class R3Object extends Event { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -2807,6 +2599,9 @@ class Coder extends Runtime { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -2912,6 +2707,9 @@ class Default extends Runtime { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -3017,6 +2815,9 @@ class GUI extends Runtime { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -3122,6 +2923,9 @@ class Graphics extends Runtime { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -3227,6 +3031,9 @@ class Physics extends Runtime { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -3332,6 +3139,9 @@ class Socket extends Runtime { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -3437,6 +3247,9 @@ class Statistics extends Runtime { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -3476,7 +3289,7 @@ class Statistics extends Runtime { Inherited Methods: - initialized() - Emits an event which indicates that this object instance is ready to be created + Overrides for R3.Event.initialized() Inherited Static Methods: @@ -3495,7 +3308,7 @@ class Statistics extends Runtime { Methods: - initialized() - In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + Should raises an event(s) which indicates that this object initialized - createInstance() Creates an instance of this object based on the current runtime @@ -3547,13 +3360,17 @@ class Component extends R3Object { /** * initialized() - * - In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + * - Should raises an event(s) which indicates that this object initialized */ initialized() { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + if (this.hasOwnProperty('callDepth')) { + delete this.callDepth; + } else { + console.warn('Multiple calls to initialized() - check your callstack'); + } + Event.Emit(Event.OBJECT_INITIALIZED, this); Event.Emit(Event.COMPONENT_INITIALIZED, this); } @@ -3637,10 +3454,9 @@ class Component extends R3Object { Component.DOM = 0x0; Component.CANVAS = 0x1; -Component.IMAGE = 0x2; -Component.INPUT = 0x3; -Component.TOUCH = 0x4; -Component.MAX_COMPONENTS = 0x5; +Component.INPUT = 0x2; +Component.TOUCH = 0x3; +Component.MAX_COMPONENTS = 0x4; /** @@ -3657,6 +3473,9 @@ Component.MAX_COMPONENTS = 0x5; Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -3696,7 +3515,7 @@ Component.MAX_COMPONENTS = 0x5; Inherited Methods: - initialized() - Emits an event which indicates that this object instance is ready to be created + Overrides for R3.Event.initialized() Inherited Static Methods: @@ -3714,7 +3533,8 @@ Component.MAX_COMPONENTS = 0x5; Methods: - + - initialized() + Overrides for R3.Event.R3Object.initialized() Static Methods: @@ -3748,6 +3568,22 @@ class Project extends R3Object { } + /** + * initialized() + * - Should raise an event(s) which indicates that this object initialized + */ + initialized() { + + if (this.hasOwnProperty('callDepth')) { + delete this.callDepth; + } else { + console.warn('Multiple calls to initialized() - check your callstack'); + } + + Event.Emit(Event.PROJECT_INITIALIZED, this); + + } + } /** @@ -3765,6 +3601,9 @@ class Project extends R3Object { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -3873,6 +3712,132 @@ class CodeMirror extends Coder { } +/** + + Class R3.Event.Runtime.Default.Document + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - initialized() + Should raise an event(s) which indicates that this object initialized + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from Default] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to Document] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class Document extends Default { + + 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--; + } + + } + +} + /** Class R3.Event.Runtime.GUI.ControlKit @@ -3888,6 +3853,9 @@ class CodeMirror extends Coder { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -4011,6 +3979,9 @@ class ControlKit extends GUI { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -4134,6 +4105,9 @@ class Three extends Graphics { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -4257,6 +4231,9 @@ class Bullet extends Physics { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -4380,6 +4357,9 @@ class Stats extends Statistics { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -4419,7 +4399,7 @@ class Stats extends Statistics { Inherited Methods: - initialized() - Emits an event which indicates that this object instance is ready to be created + Overrides for R3.Event.initialized() Inherited Static Methods: @@ -4438,7 +4418,7 @@ class Stats extends Statistics { Inherited Methods: - initialized() - In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + Should raises an event(s) which indicates that this object initialized - createInstance() Creates an instance of this object based on the current runtime @@ -4514,9 +4494,13 @@ class DOM extends Component { */ initialized() { - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + if (this.hasOwnProperty('callDepth')) { + delete this.callDepth; + } else { + console.warn('Multiple calls to initialized() - check your callstack'); + } + Event.Emit(Event.OBJECT_INITIALIZED, this); Event.Emit(Event.COMPONENT_INITIALIZED, this); Event.Emit(Event.DOM_COMPONENT_INITIALIZED, this); @@ -4524,148 +4508,6 @@ class DOM extends Component { } -/** - - Class R3.Event.Object.Component.Image - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - id (Default value Utils.RandomId(10)) - - name (Default value 'Object ' + options.id) - - register (Default value true) - - Inherited Static Properties: - - - - Inherited Methods: - - - initialized() - Emits an event which indicates that this object instance is ready to be created - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - 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 - - - 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 - - Inherited Static Methods: - - - - [Belonging to Image] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class Image extends Component { - - 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--; - } - - } - -} - /** Class R3.Event.Object.Component.Input @@ -4681,6 +4523,9 @@ class Image extends Component { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -4720,7 +4565,7 @@ class Image extends Component { Inherited Methods: - initialized() - Emits an event which indicates that this object instance is ready to be created + Overrides for R3.Event.initialized() Inherited Static Methods: @@ -4739,7 +4584,7 @@ class Image extends Component { Inherited Methods: - initialized() - In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + Should raises an event(s) which indicates that this object initialized - createInstance() Creates an instance of this object based on the current runtime @@ -4772,7 +4617,9 @@ class Image extends Component { Methods: - + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + Event.INPUT_COMPONENT_INITIALIZED Static Methods: @@ -4804,7 +4651,25 @@ class Input extends Component { options.callDepth--; } - this.emit(Event.INPUT_COMPONENT_INITIALIZED); + } + + /** + * initialized() + * - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + * Event.INPUT_COMPONENT_INITIALIZED + */ + initialized() { + + if (this.hasOwnProperty('callDepth')) { + delete this.callDepth; + } else { + console.warn('Multiple calls to initialized() - check your callstack'); + } + + Event.Emit(Event.OBJECT_INITIALIZED, this); + Event.Emit(Event.COMPONENT_INITIALIZED, this); + Event.Emit(Event.INPUT_COMPONENT_INITIALIZED, this); + } } @@ -4824,6 +4689,9 @@ class Input extends Component { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -4863,7 +4731,7 @@ class Input extends Component { Inherited Methods: - initialized() - Emits an event which indicates that this object instance is ready to be created + Overrides for R3.Event.initialized() Inherited Static Methods: @@ -4882,7 +4750,7 @@ class Input extends Component { Inherited Methods: - initialized() - In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + Should raises an event(s) which indicates that this object initialized - createInstance() Creates an instance of this object based on the current runtime @@ -4986,6 +4854,9 @@ class Canvas extends DOM { Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -5025,7 +4896,7 @@ class Canvas extends DOM { Inherited Methods: - initialized() - Emits an event which indicates that this object instance is ready to be created + Overrides for R3.Event.initialized() Inherited Static Methods: @@ -5044,7 +4915,7 @@ class Canvas extends DOM { Inherited Methods: - initialized() - In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + Should raises an event(s) which indicates that this object initialized - createInstance() Creates an instance of this object based on the current runtime @@ -5077,7 +4948,9 @@ class Canvas extends DOM { Inherited Methods: - + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + Event.INPUT_COMPONENT_INITIALIZED Inherited Static Methods: @@ -5140,7 +5013,6 @@ R3.Component = Component; R3.Project = Project; R3.DOM = DOM; R3.Canvas = Canvas; -R3.Image = Image; R3.Input = Input; R3.Touch = Touch; System.DOM = SystemDOM; @@ -5149,12 +5021,12 @@ System.Linking = SystemLinking; System.Socket = SystemSocket; Component.DOM = DOM; Component.DOM.Canvas = Canvas; -Component.Image = Image; Component.Input = Input; Component.Input.Touch = Touch; Runtime.Coder = Coder; Runtime.Coder.CodeMirror = CodeMirror; Runtime.Default = Default; +Runtime.Default.Document = Document; Runtime.GUI = GUI; Runtime.GUI.ControlKit = ControlKit; Runtime.Graphics = Graphics; diff --git a/package.json b/package.json index ba2ffbd..4e2b68e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "r3", - "version" : "2.0.228", + "version" : "2.0.448", "description": "", "private": true, "dependencies": { diff --git a/src/r3/r3-component/index.js b/src/r3/r3-component/index.js index 85f72f8..6ec782d 100644 --- a/src/r3/r3-component/index.js +++ b/src/r3/r3-component/index.js @@ -2,7 +2,6 @@ const Component = require('./r3-component.js'); const DOM = require('./r3-d-o-m.js'); const Canvas = require('./r3-canvas.js'); -const Image = require('./r3-image.js'); const Input = require('./r3-input.js'); const Touch = require('./r3-touch.js'); //GENERATED_IMPORTS_END @@ -10,7 +9,6 @@ const Touch = require('./r3-touch.js'); //GENERATED_INDEX_BODY_START Component.DOM = DOM; Component.DOM.Canvas = Canvas; -Component.Image = Image; Component.Input = Input; Component.Input.Touch = Touch; //GENERATED_INDEX_BODY_END diff --git a/src/r3/r3-component/r3-canvas.js b/src/r3/r3-component/r3-canvas.js index 582e6aa..00c50f1 100644 --- a/src/r3/r3-component/r3-canvas.js +++ b/src/r3/r3-component/r3-canvas.js @@ -19,6 +19,9 @@ const DOM = require('.././r3-d-o-m.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -58,7 +61,7 @@ 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 + Overrides for R3.Event.initialized() Inherited Static Methods: @@ -77,7 +80,7 @@ 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 + Should raises an event(s) which indicates that this object initialized - createInstance() Creates an instance of this object based on the current runtime diff --git a/src/r3/r3-component/r3-component.js b/src/r3/r3-component/r3-component.js index 2858799..4ac1a08 100644 --- a/src/r3/r3-component/r3-component.js +++ b/src/r3/r3-component/r3-component.js @@ -19,6 +19,9 @@ const R3Object = require('.././r3-r3-object.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -58,7 +61,7 @@ const R3Object = require('.././r3-r3-object.js'); Inherited Methods: - initialized() - Emits an event which indicates that this object instance is ready to be created + Overrides for R3.Event.initialized() Inherited Static Methods: @@ -77,7 +80,7 @@ const R3Object = require('.././r3-r3-object.js'); Methods: - initialized() - In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + Should raises an event(s) which indicates that this object initialized - createInstance() Creates an instance of this object based on the current runtime @@ -113,7 +116,7 @@ const R3Object = require('.././r3-r3-object.js'); CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_METHODS_START - initialized() - In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + initialized() - Should raises an event(s) which indicates that this object 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. @@ -170,16 +173,20 @@ class Component extends R3Object { /** * initialized() - * - In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + * - Should raises an event(s) which indicates that this object initialized */ initialized() { //GENERATED_INITIALIZED_METHOD_START - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + if (this.hasOwnProperty('callDepth')) { + delete this.callDepth; + } else { + console.warn('Multiple calls to initialized() - check your callstack'); + } //GENERATED_INITIALIZED_METHOD_END //CUSTOM_INITIALIZED_METHOD_START + Event.Emit(Event.OBJECT_INITIALIZED, this); Event.Emit(Event.COMPONENT_INITIALIZED, this); //CUSTOM_INITIALIZED_METHOD_END @@ -303,10 +310,9 @@ class Component extends R3Object { //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START Component.DOM = 0x0; Component.CANVAS = 0x1; -Component.IMAGE = 0x2; -Component.INPUT = 0x3; -Component.TOUCH = 0x4; -Component.MAX_COMPONENTS = 0x5; +Component.INPUT = 0x2; +Component.TOUCH = 0x3; +Component.MAX_COMPONENTS = 0x4; //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START diff --git a/src/r3/r3-component/r3-d-o-m.js b/src/r3/r3-component/r3-d-o-m.js index cb53742..a989aa1 100644 --- a/src/r3/r3-component/r3-d-o-m.js +++ b/src/r3/r3-component/r3-d-o-m.js @@ -19,6 +19,9 @@ const Component = require('.././r3-component.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -58,7 +61,7 @@ const Component = require('.././r3-component.js'); Inherited Methods: - initialized() - Emits an event which indicates that this object instance is ready to be created + Overrides for R3.Event.initialized() Inherited Static Methods: @@ -77,7 +80,7 @@ const Component = require('.././r3-component.js'); Inherited Methods: - initialized() - In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + Should raises an event(s) which indicates that this object initialized - createInstance() Creates an instance of this object based on the current runtime @@ -190,11 +193,15 @@ class DOM extends Component { initialized() { //GENERATED_INITIALIZED_METHOD_START - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + if (this.hasOwnProperty('callDepth')) { + delete this.callDepth; + } else { + console.warn('Multiple calls to initialized() - check your callstack'); + } //GENERATED_INITIALIZED_METHOD_END //CUSTOM_INITIALIZED_METHOD_START + Event.Emit(Event.OBJECT_INITIALIZED, this); Event.Emit(Event.COMPONENT_INITIALIZED, this); Event.Emit(Event.DOM_COMPONENT_INITIALIZED, this); //CUSTOM_INITIALIZED_METHOD_END diff --git a/src/r3/r3-component/r3-input.js b/src/r3/r3-component/r3-input.js index d06e6c8..9e20aa2 100644 --- a/src/r3/r3-component/r3-input.js +++ b/src/r3/r3-component/r3-input.js @@ -19,6 +19,9 @@ const Component = require('.././r3-component.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -58,7 +61,7 @@ const Component = require('.././r3-component.js'); Inherited Methods: - initialized() - Emits an event which indicates that this object instance is ready to be created + Overrides for R3.Event.initialized() Inherited Static Methods: @@ -77,7 +80,7 @@ const Component = require('.././r3-component.js'); Inherited Methods: - initialized() - In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + Should raises an event(s) which indicates that this object initialized - createInstance() Creates an instance of this object based on the current runtime @@ -110,7 +113,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.INPUT_COMPONENT_INITIALIZED Static Methods: @@ -131,6 +136,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.INPUT_COMPONENT_INITIALIZED CUSTOM_METHODS_END CUSTOM_STATIC_METHODS_START @@ -173,12 +179,34 @@ class Input extends Component { } //CUSTOM_AFTER_INIT_START - this.emit(Event.INPUT_COMPONENT_INITIALIZED); //CUSTOM_AFTER_INIT_END } //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.INPUT_COMPONENT_INITIALIZED + */ + initialized() { + + //GENERATED_INITIALIZED_METHOD_START + if (this.hasOwnProperty('callDepth')) { + delete this.callDepth; + } else { + console.warn('Multiple calls to initialized() - check your callstack'); + } + //GENERATED_INITIALIZED_METHOD_END + + //CUSTOM_INITIALIZED_METHOD_START + Event.Emit(Event.OBJECT_INITIALIZED, this); + Event.Emit(Event.COMPONENT_INITIALIZED, this); + Event.Emit(Event.INPUT_COMPONENT_INITIALIZED, this); + //CUSTOM_INITIALIZED_METHOD_END + + } //GENERATED_METHODS_END //GENERATED_STATIC_METHODS_START diff --git a/src/r3/r3-component/r3-touch.js b/src/r3/r3-component/r3-touch.js index 155b0e0..48ebdb2 100644 --- a/src/r3/r3-component/r3-touch.js +++ b/src/r3/r3-component/r3-touch.js @@ -19,6 +19,9 @@ const Input = require('.././r3-input.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -58,7 +61,7 @@ const Input = require('.././r3-input.js'); Inherited Methods: - initialized() - Emits an event which indicates that this object instance is ready to be created + Overrides for R3.Event.initialized() Inherited Static Methods: @@ -77,7 +80,7 @@ const Input = require('.././r3-input.js'); Inherited Methods: - initialized() - In addition to firing an Event.OBJECT_INITIALIZED it also fires an Event.COMPONENT_INITIALIZED + Should raises an event(s) which indicates that this object initialized - createInstance() Creates an instance of this object based on the current runtime @@ -110,7 +113,9 @@ const Input = require('.././r3-input.js'); Inherited Methods: - + - initialized() + In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + Event.INPUT_COMPONENT_INITIALIZED Inherited Static Methods: diff --git a/src/r3/r3-event.js b/src/r3/r3-event.js index a312604..2a855b4 100644 --- a/src/r3/r3-event.js +++ b/src/r3/r3-event.js @@ -10,15 +10,16 @@ const Utils = require('./r3-utils'); CUSTOM_OPTIONS_END CUSTOM_METHODS_START - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments + initialized() - Should raise an event(s) which indicates that this object initialized + async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments + emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments + subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments CUSTOM_METHODS_END CUSTOM_STATIC_METHODS_START - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the error as argument. - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after the event result is obtained, passing it the result. If an exception occurs during execution, the clientErrorCallback is called with the error as argument. - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised @return {Object} - A handle to the subscription which can be removed by calling handle.remove() + Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the error as argument. + Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after the event result is obtained, passing it the result. If an exception occurs during execution, the clientErrorCallback is called with the error as argument. + Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised @return {Object} - A handle to the subscription which can be removed by calling handle.remove() CUSTOM_STATIC_METHODS_END **/ @@ -74,6 +75,26 @@ class Event { //GENERATED_METHODS_START + /** + * initialized() + * - Should raise an event(s) which indicates that this object initialized + */ + initialized() { + + //GENERATED_INITIALIZED_METHOD_START + if (this.hasOwnProperty('callDepth')) { + delete this.callDepth; + } else { + console.warn('Multiple calls to initialized() - check your callstack'); + } + //GENERATED_INITIALIZED_METHOD_END + + //CUSTOM_INITIALIZED_METHOD_START + Event.Emit(Event.EVENT_INITIALIZED, this); + //CUSTOM_INITIALIZED_METHOD_END + + } + /** * async() * - Simply calls 'Async()' passing it the arguments @@ -340,15 +361,16 @@ 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.PROJECT_INITIALIZED = 0x15; +Event.RESTART = 0x16; +Event.START = 0x17; +Event.TOUCH_CANCEL = 0x18; +Event.TOUCH_END = 0x19; +Event.TOUCH_MOVE = 0x1a; +Event.TOUCH_START = 0x1b; +Event.UPDATE_FROM_INSTANCE_AFTER = 0x1c; +Event.UPDATE_FROM_INSTANCE_BEFORE = 0x1d; +Event.MAX_EVENTS = 0x1e; Event.GetEventName = function(eventId) { @@ -373,14 +395,15 @@ Event.GetEventName = function(eventId) { 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'; + case 0x15 : return 'project_initialized'; + case 0x16 : return 'restart'; + case 0x17 : return 'start'; + case 0x18 : return 'touch_cancel'; + case 0x19 : return 'touch_end'; + case 0x1a : return 'touch_move'; + case 0x1b : return 'touch_start'; + case 0x1c : return 'update_from_instance_after'; + case 0x1d : 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 c283e5b..7469ff9 100644 --- a/src/r3/r3-project.js +++ b/src/r3/r3-project.js @@ -19,6 +19,9 @@ const R3Object = require('./r3-r3-object.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -58,7 +61,7 @@ const R3Object = require('./r3-r3-object.js'); Inherited Methods: - initialized() - Emits an event which indicates that this object instance is ready to be created + Overrides for R3.Event.initialized() Inherited Static Methods: @@ -76,7 +79,8 @@ const R3Object = require('./r3-r3-object.js'); Methods: - + - initialized() + Overrides for R3.Event.R3Object.initialized() Static Methods: @@ -97,6 +101,7 @@ const R3Object = require('./r3-r3-object.js'); CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_METHODS_START + initialized() - Should raise an event(s) which indicates that this object initialized CUSTOM_METHODS_END CUSTOM_STATIC_METHODS_START @@ -144,6 +149,26 @@ class Project extends R3Object { //GENERATED_CONSTRUCTOR_EXTENDS_END //GENERATED_METHODS_START + + /** + * initialized() + * - Should raise an event(s) which indicates that this object initialized + */ + initialized() { + + //GENERATED_INITIALIZED_METHOD_START + if (this.hasOwnProperty('callDepth')) { + delete this.callDepth; + } else { + console.warn('Multiple calls to initialized() - check your callstack'); + } + //GENERATED_INITIALIZED_METHOD_END + + //CUSTOM_INITIALIZED_METHOD_START + Event.Emit(Event.PROJECT_INITIALIZED, this); + //CUSTOM_INITIALIZED_METHOD_END + + } //GENERATED_METHODS_END //GENERATED_STATIC_METHODS_START diff --git a/src/r3/r3-r3-object.js b/src/r3/r3-r3-object.js index 056dfca..2935ce5 100644 --- a/src/r3/r3-r3-object.js +++ b/src/r3/r3-r3-object.js @@ -18,6 +18,9 @@ const Event = require('./r3-event.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -57,7 +60,7 @@ const Event = require('./r3-event.js'); Methods: - initialized() - Emits an event which indicates that this object instance is ready to be created + Overrides for R3.Event.initialized() Static Methods: @@ -66,9 +69,9 @@ const Event = require('./r3-event.js'); GENERATED_INHERITED_END CUSTOM_OPTIONS_START - id=Utils.RandomId(10) - name='Object ' + options.id - register=true + id=Utils.RandomId(10) + name='Object ' + options.id + register=true CUSTOM_OPTIONS_END CUSTOM_INSTANCE_OPTIONS_MAPPING_START @@ -81,7 +84,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 + initialized() - Should raise an event(s) which indicates that this object initialized CUSTOM_METHODS_END CUSTOM_STATIC_METHODS_START @@ -144,16 +147,20 @@ class R3Object extends Event { /** * initialized() - * - Emits an event which indicates that this object instance is ready to be created + * - Should raise an event(s) which indicates that this object initialized */ initialized() { //GENERATED_INITIALIZED_METHOD_START - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; + if (this.hasOwnProperty('callDepth')) { + delete this.callDepth; + } else { + console.warn('Multiple calls to initialized() - check your callstack'); + } //GENERATED_INITIALIZED_METHOD_END //CUSTOM_INITIALIZED_METHOD_START + Event.Emit(Event.OBJECT_INITIALIZED, this); //CUSTOM_INITIALIZED_METHOD_END } diff --git a/src/r3/r3-r3.js b/src/r3/r3-r3.js index 4c20a76..8981da2 100644 --- a/src/r3/r3-r3.js +++ b/src/r3/r3-r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.228'; - static compileDate = '2021 Sep 08 - 23:13:48 pm'; + static version = '2.0.448'; + static compileDate = '2021 Sep 09 - 17:56:56 pm'; } //GENERATED_IMPORTS_START @@ -23,7 +23,6 @@ R3.Component = Component; R3.Project = Project; R3.DOM = DOM; R3.Canvas = Canvas; -R3.Image = Image; R3.Input = Input; R3.Touch = Touch; //GENERATED_DEFINES_END diff --git a/src/r3/r3-runtime/index.js b/src/r3/r3-runtime/index.js index 8575afa..26f2650 100644 --- a/src/r3/r3-runtime/index.js +++ b/src/r3/r3-runtime/index.js @@ -3,6 +3,7 @@ const Runtime = require('./r3-runtime.js'); const Coder = require('./r3-coder.js'); const CodeMirror = require('./r3-code-mirror.js'); const Default = require('./r3-default.js'); +const Document = require('./r3-document.js'); const GUI = require('./r3-g-u-i.js'); const ControlKit = require('./r3-control-kit.js'); const Graphics = require('./r3-graphics.js'); @@ -18,6 +19,7 @@ const Stats = require('./r3-stats.js'); Runtime.Coder = Coder; Runtime.Coder.CodeMirror = CodeMirror; Runtime.Default = Default; +Runtime.Default.Document = Document; Runtime.GUI = GUI; Runtime.GUI.ControlKit = ControlKit; Runtime.Graphics = Graphics; diff --git a/src/r3/r3-runtime/r3-bullet.js b/src/r3/r3-runtime/r3-bullet.js index 24ee027..cf6d663 100644 --- a/src/r3/r3-runtime/r3-bullet.js +++ b/src/r3/r3-runtime/r3-bullet.js @@ -19,6 +19,9 @@ const Physics = require('.././r3-physics.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments diff --git a/src/r3/r3-runtime/r3-code-mirror.js b/src/r3/r3-runtime/r3-code-mirror.js index 56a8358..f5551bd 100644 --- a/src/r3/r3-runtime/r3-code-mirror.js +++ b/src/r3/r3-runtime/r3-code-mirror.js @@ -19,6 +19,9 @@ const Coder = require('.././r3-coder.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments diff --git a/src/r3/r3-runtime/r3-coder.js b/src/r3/r3-runtime/r3-coder.js index 8c903e5..ec766c1 100644 --- a/src/r3/r3-runtime/r3-coder.js +++ b/src/r3/r3-runtime/r3-coder.js @@ -19,6 +19,9 @@ const Runtime = require('.././r3-runtime.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments diff --git a/src/r3/r3-runtime/r3-control-kit.js b/src/r3/r3-runtime/r3-control-kit.js index 13e92a0..8c4016d 100644 --- a/src/r3/r3-runtime/r3-control-kit.js +++ b/src/r3/r3-runtime/r3-control-kit.js @@ -19,6 +19,9 @@ const GUI = require('.././r3-g-u-i.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments diff --git a/src/r3/r3-runtime/r3-default.js b/src/r3/r3-runtime/r3-default.js index 6717408..01c29b7 100644 --- a/src/r3/r3-runtime/r3-default.js +++ b/src/r3/r3-runtime/r3-default.js @@ -19,6 +19,9 @@ const Runtime = require('.././r3-runtime.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments diff --git a/src/r3/r3-component/r3-image.js b/src/r3/r3-runtime/r3-document.js similarity index 78% rename from src/r3/r3-component/r3-image.js rename to src/r3/r3-runtime/r3-document.js index 09b3c7b..81f912d 100644 --- a/src/r3/r3-component/r3-image.js +++ b/src/r3/r3-runtime/r3-document.js @@ -1,12 +1,12 @@ const Event = require('.././r3-event'); const Utils = require('.././r3-utils'); -const Component = require('.././r3-component.js'); +const Default = require('.././r3-default.js'); /** GENERATED_INHERITED_START - Class R3.Event.Object.Component.Image + Class R3.Event.Runtime.Default.Document [Inherited from Event] Inherited Properties: @@ -19,6 +19,9 @@ const Component = require('.././r3-component.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -43,28 +46,7 @@ const Component = require('.././r3-component.js'); - Subscribe(eventId, callback) Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - [Inherited from R3Object] - - Inherited Properties: - - - id (Default value Utils.RandomId(10)) - - name (Default value 'Object ' + options.id) - - register (Default value true) - - Inherited Static Properties: - - - - Inherited Methods: - - - initialized() - Emits an event which indicates that this object instance is ready to be created - - Inherited Static Methods: - - - - [Inherited from Component] + [Inherited from Runtime] Inherited Properties: @@ -76,29 +58,31 @@ 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 - - - 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 + Inherited Static Methods: - [Belonging to Image] + [Inherited from Default] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to Document] Properties: @@ -138,7 +122,7 @@ const Component = require('.././r3-component.js'); **/ -class Image extends Component { +class Document extends Default { //GENERATED_CONSTRUCTOR_EXTENDS_START constructor(options) { @@ -193,4 +177,4 @@ class Image extends Component { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = Image; +module.exports = Document; diff --git a/src/r3/r3-runtime/r3-g-u-i.js b/src/r3/r3-runtime/r3-g-u-i.js index 0cc3f7d..bf7e115 100644 --- a/src/r3/r3-runtime/r3-g-u-i.js +++ b/src/r3/r3-runtime/r3-g-u-i.js @@ -19,6 +19,9 @@ const Runtime = require('.././r3-runtime.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments diff --git a/src/r3/r3-runtime/r3-graphics.js b/src/r3/r3-runtime/r3-graphics.js index 786517b..07d5426 100644 --- a/src/r3/r3-runtime/r3-graphics.js +++ b/src/r3/r3-runtime/r3-graphics.js @@ -19,6 +19,9 @@ const Runtime = require('.././r3-runtime.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments diff --git a/src/r3/r3-runtime/r3-physics.js b/src/r3/r3-runtime/r3-physics.js index ff6efff..c7e9644 100644 --- a/src/r3/r3-runtime/r3-physics.js +++ b/src/r3/r3-runtime/r3-physics.js @@ -19,6 +19,9 @@ const Runtime = require('.././r3-runtime.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments diff --git a/src/r3/r3-runtime/r3-runtime.js b/src/r3/r3-runtime/r3-runtime.js index 0c055a6..359bf04 100644 --- a/src/r3/r3-runtime/r3-runtime.js +++ b/src/r3/r3-runtime/r3-runtime.js @@ -18,6 +18,9 @@ const Event = require('.././r3-event.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments @@ -135,16 +138,17 @@ class Runtime extends Event { Runtime.CODER = 0x0; Runtime.CODE_MIRROR = 0x1; Runtime.DEFAULT = 0x2; -Runtime.GUI = 0x3; -Runtime.CONTROL_KIT = 0x4; -Runtime.GRAPHICS = 0x5; -Runtime.THREE = 0x6; -Runtime.PHYSICS = 0x7; -Runtime.BULLET = 0x8; -Runtime.SOCKET = 0x9; -Runtime.STATISTICS = 0xa; -Runtime.STATS = 0xb; -Runtime.MAX_RUNTIMES = 0xc; +Runtime.DOCUMENT = 0x3; +Runtime.GUI = 0x4; +Runtime.CONTROL_KIT = 0x5; +Runtime.GRAPHICS = 0x6; +Runtime.THREE = 0x7; +Runtime.PHYSICS = 0x8; +Runtime.BULLET = 0x9; +Runtime.SOCKET = 0xa; +Runtime.STATISTICS = 0xb; +Runtime.STATS = 0xc; +Runtime.MAX_RUNTIMES = 0xd; //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START diff --git a/src/r3/r3-runtime/r3-socket.js b/src/r3/r3-runtime/r3-socket.js index f72da40..12d634b 100644 --- a/src/r3/r3-runtime/r3-socket.js +++ b/src/r3/r3-runtime/r3-socket.js @@ -19,6 +19,9 @@ const Runtime = require('.././r3-runtime.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments diff --git a/src/r3/r3-runtime/r3-statistics.js b/src/r3/r3-runtime/r3-statistics.js index 2814066..d836cde 100644 --- a/src/r3/r3-runtime/r3-statistics.js +++ b/src/r3/r3-runtime/r3-statistics.js @@ -19,6 +19,9 @@ const Runtime = require('.././r3-runtime.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments diff --git a/src/r3/r3-runtime/r3-stats.js b/src/r3/r3-runtime/r3-stats.js index 3f21e84..0421bb2 100644 --- a/src/r3/r3-runtime/r3-stats.js +++ b/src/r3/r3-runtime/r3-stats.js @@ -19,6 +19,9 @@ const Statistics = require('.././r3-statistics.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments diff --git a/src/r3/r3-runtime/r3-three.js b/src/r3/r3-runtime/r3-three.js index e3a1955..58fb19a 100644 --- a/src/r3/r3-runtime/r3-three.js +++ b/src/r3/r3-runtime/r3-three.js @@ -19,6 +19,9 @@ const Graphics = require('.././r3-graphics.js'); Inherited Methods: + - initialized() + Should raise an event(s) which indicates that this object initialized + - async(eventId, data, clientCallback, clientErrorCallback) Simply calls 'Async()' passing it the arguments 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 6f3045c..d603c08 100644 --- a/src/r3/r3-system/r3-system-d-o-m.js +++ b/src/r3/r3-system/r3-system-d-o-m.js @@ -11,18 +11,15 @@ const System = require('./r3-system.js'); Inherited Properties: - - started (Default value false) - - subscriptions (Default value {}) + Inherited Static Properties: - - Started (Default value false) - - Subscriptions (Default value {}) + Inherited Methods: - - initialized() - No comment + Inherited Static Methods: @@ -32,8 +29,7 @@ const System = require('./r3-system.js'); Properties: - - started (Default value false) - - subscriptions (Default value {}) + Static Properties: @@ -42,11 +38,7 @@ const System = require('./r3-system.js'); Methods: - - start() - Starts a transient system by registering subscriptions to Events - - - stop() - Stops a transient system to by removing subscriptions to Events + Static Methods: @@ -59,8 +51,6 @@ const System = require('./r3-system.js'); GENERATED_INHERITED_END CUSTOM_OPTIONS_START - started=false - subscriptions={} CUSTOM_OPTIONS_END CUSTOM_STATIC_OPTIONS_START @@ -76,8 +66,6 @@ const System = require('./r3-system.js'); CUSTOM_STATIC_EVENT_LISTENERS_END CUSTOM_METHODS_START - start() - Starts a transient system by registering subscriptions to Events - stop() - Stops a transient system to by removing subscriptions to Events CUSTOM_METHODS_END CUSTOM_STATIC_METHODS_START @@ -96,23 +84,9 @@ class SystemDOM extends System { options = {}; } - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - super(options); //GENERATED_OPTIONS_INIT_START - - if (typeof options.started === 'undefined') { - options.started = false; - } - - if (typeof options.subscriptions === 'undefined') { - options.subscriptions = {}; - } //GENERATED_OPTIONS_INIT_END //CUSTOM_OPTIONS_INIT_START @@ -123,66 +97,12 @@ class SystemDOM extends System { //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 - - /** - * start() - * - Starts a transient system by registering subscriptions to Events - */ - start() { - - //GENERATED_START_METHOD_START - - //GENERATED_EVENT_LISTENERS_START_START - //GENERATED_EVENT_LISTENERS_START_END - - //CUSTOM_BEFORE_SYSTEM_START_START - //CUSTOM_BEFORE_SYSTEM_START_END - - this.started = true; - - console.log('Started transient system: SystemDOM'); - //GENERATED_START_METHOD_END - - //CUSTOM_START_METHOD_START - //CUSTOM_START_METHOD_END - - } - - /** - * stop() - * - Stops a transient system to by removing subscriptions to Events - */ - stop() { - - //GENERATED_STOP_METHOD_START - - //GENERATED_EVENT_LISTENERS_STOP_START - //GENERATED_EVENT_LISTENERS_STOP_END - - //CUSTOM_BEFORE_SYSTEM_STOP_START - //CUSTOM_BEFORE_SYSTEM_STOP_END - - this.started = false; - - console.log('Stopped transient system: SystemDOM'); - //GENERATED_STOP_METHOD_END - - //CUSTOM_STOP_METHOD_START - //CUSTOM_STOP_METHOD_END - - } //GENERATED_METHODS_END //GENERATED_STATIC_METHODS_START diff --git a/src/r3/r3-system/r3-system-input.js b/src/r3/r3-system/r3-system-input.js index eb7a00e..cc83be6 100644 --- a/src/r3/r3-system/r3-system-input.js +++ b/src/r3/r3-system/r3-system-input.js @@ -11,18 +11,15 @@ const System = require('./r3-system.js'); Inherited Properties: - - started (Default value false) - - subscriptions (Default value {}) + Inherited Static Properties: - - Started (Default value false) - - Subscriptions (Default value {}) + Inherited Methods: - - initialized() - No comment + Inherited Static Methods: @@ -32,8 +29,7 @@ const System = require('./r3-system.js'); Properties: - - started (Default value false) - - subscriptions (Default value {}) + Static Properties: @@ -42,11 +38,7 @@ const System = require('./r3-system.js'); Methods: - - start() - Starts a transient system by registering subscriptions to Events - - - stop() - Stops a transient system to by removing subscriptions to Events + Static Methods: @@ -59,8 +51,6 @@ const System = require('./r3-system.js'); GENERATED_INHERITED_END CUSTOM_OPTIONS_START - started=false - subscriptions={} CUSTOM_OPTIONS_END CUSTOM_STATIC_OPTIONS_START @@ -85,8 +75,6 @@ const System = require('./r3-system.js'); CUSTOM_STATIC_EVENT_LISTENERS_END CUSTOM_METHODS_START - start() - Starts a transient system by registering subscriptions to Events - stop() - Stops a transient system to by removing subscriptions to Events CUSTOM_METHODS_END CUSTOM_STATIC_METHODS_START @@ -105,23 +93,9 @@ class SystemInput extends System { options = {}; } - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - super(options); //GENERATED_OPTIONS_INIT_START - - if (typeof options.started === 'undefined') { - options.started = false; - } - - if (typeof options.subscriptions === 'undefined') { - options.subscriptions = {}; - } //GENERATED_OPTIONS_INIT_END //CUSTOM_OPTIONS_INIT_START @@ -132,67 +106,12 @@ class SystemInput extends System { //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 - - /** - * start() - * - Starts a transient system by registering subscriptions to Events - */ - start() { - - //GENERATED_START_METHOD_START - - //GENERATED_EVENT_LISTENERS_START_START - //GENERATED_EVENT_LISTENERS_START_END - - //CUSTOM_BEFORE_SYSTEM_START_START - console.log('Test for custom start before'); - //CUSTOM_BEFORE_SYSTEM_START_END - - this.started = true; - - console.log('Started transient system: SystemInput'); - //GENERATED_START_METHOD_END - - //CUSTOM_START_METHOD_START - //CUSTOM_START_METHOD_END - - } - - /** - * stop() - * - Stops a transient system to by removing subscriptions to Events - */ - stop() { - - //GENERATED_STOP_METHOD_START - - //GENERATED_EVENT_LISTENERS_STOP_START - //GENERATED_EVENT_LISTENERS_STOP_END - - //CUSTOM_BEFORE_SYSTEM_STOP_START - //CUSTOM_BEFORE_SYSTEM_STOP_END - - this.started = false; - - console.log('Stopped transient system: SystemInput'); - //GENERATED_STOP_METHOD_END - - //CUSTOM_STOP_METHOD_START - //CUSTOM_STOP_METHOD_END - - } //GENERATED_METHODS_END //GENERATED_STATIC_METHODS_START diff --git a/src/r3/r3-system/r3-system-linking.js b/src/r3/r3-system/r3-system-linking.js index f0cae64..6db01ea 100644 --- a/src/r3/r3-system/r3-system-linking.js +++ b/src/r3/r3-system/r3-system-linking.js @@ -11,18 +11,15 @@ const System = require('./r3-system.js'); Inherited Properties: - - started (Default value false) - - subscriptions (Default value {}) + Inherited Static Properties: - - Started (Default value false) - - Subscriptions (Default value {}) + Inherited Methods: - - initialized() - No comment + Inherited Static Methods: @@ -32,8 +29,7 @@ const System = require('./r3-system.js'); Properties: - - started (Default value false) - - subscriptions (Default value {}) + Static Properties: @@ -42,11 +38,7 @@ const System = require('./r3-system.js'); Methods: - - start() - Starts a transient system by registering subscriptions to Events - - - stop() - Stops a transient system to by removing subscriptions to Events + Static Methods: @@ -59,8 +51,6 @@ const System = require('./r3-system.js'); GENERATED_INHERITED_END CUSTOM_OPTIONS_START - started=false - subscriptions={} CUSTOM_OPTIONS_END CUSTOM_STATIC_OPTIONS_START @@ -78,8 +68,6 @@ const System = require('./r3-system.js'); CUSTOM_STATIC_EVENT_LISTENERS_END CUSTOM_METHODS_START - start() - Starts a transient system by registering subscriptions to Events - stop() - Stops a transient system to by removing subscriptions to Events CUSTOM_METHODS_END CUSTOM_STATIC_METHODS_START @@ -98,23 +86,9 @@ class SystemLinking extends System { options = {}; } - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - super(options); //GENERATED_OPTIONS_INIT_START - - if (typeof options.started === 'undefined') { - options.started = false; - } - - if (typeof options.subscriptions === 'undefined') { - options.subscriptions = {}; - } //GENERATED_OPTIONS_INIT_END //CUSTOM_OPTIONS_INIT_START @@ -125,66 +99,12 @@ class SystemLinking extends System { //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 - - /** - * start() - * - Starts a transient system by registering subscriptions to Events - */ - start() { - - //GENERATED_START_METHOD_START - - //GENERATED_EVENT_LISTENERS_START_START - //GENERATED_EVENT_LISTENERS_START_END - - //CUSTOM_BEFORE_SYSTEM_START_START - //CUSTOM_BEFORE_SYSTEM_START_END - - this.started = true; - - console.log('Started transient system: SystemLinking'); - //GENERATED_START_METHOD_END - - //CUSTOM_START_METHOD_START - //CUSTOM_START_METHOD_END - - } - - /** - * stop() - * - Stops a transient system to by removing subscriptions to Events - */ - stop() { - - //GENERATED_STOP_METHOD_START - - //GENERATED_EVENT_LISTENERS_STOP_START - //GENERATED_EVENT_LISTENERS_STOP_END - - //CUSTOM_BEFORE_SYSTEM_STOP_START - //CUSTOM_BEFORE_SYSTEM_STOP_END - - this.started = false; - - console.log('Stopped transient system: SystemLinking'); - //GENERATED_STOP_METHOD_END - - //CUSTOM_STOP_METHOD_START - //CUSTOM_STOP_METHOD_END - - } //GENERATED_METHODS_END //GENERATED_STATIC_METHODS_START diff --git a/src/r3/r3-system/r3-system-socket.js b/src/r3/r3-system/r3-system-socket.js index 566209e..4a84dfa 100644 --- a/src/r3/r3-system/r3-system-socket.js +++ b/src/r3/r3-system/r3-system-socket.js @@ -11,18 +11,15 @@ const System = require('./r3-system.js'); Inherited Properties: - - started (Default value false) - - subscriptions (Default value {}) + Inherited Static Properties: - - Started (Default value false) - - Subscriptions (Default value {}) + Inherited Methods: - - initialized() - No comment + Inherited Static Methods: @@ -32,8 +29,7 @@ const System = require('./r3-system.js'); Properties: - - started (Default value false) - - subscriptions (Default value {}) + Static Properties: @@ -42,11 +38,7 @@ const System = require('./r3-system.js'); Methods: - - start() - Starts a transient system by registering subscriptions to Events - - - stop() - Stops a transient system to by removing subscriptions to Events + Static Methods: @@ -59,8 +51,6 @@ const System = require('./r3-system.js'); GENERATED_INHERITED_END CUSTOM_OPTIONS_START - started=false - subscriptions={} CUSTOM_OPTIONS_END CUSTOM_STATIC_OPTIONS_START @@ -75,8 +65,6 @@ const System = require('./r3-system.js'); CUSTOM_STATIC_EVENT_LISTENERS_END CUSTOM_METHODS_START - start() - Starts a transient system by registering subscriptions to Events - stop() - Stops a transient system to by removing subscriptions to Events CUSTOM_METHODS_END CUSTOM_STATIC_METHODS_START @@ -95,23 +83,9 @@ class SystemSocket extends System { options = {}; } - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - super(options); //GENERATED_OPTIONS_INIT_START - - if (typeof options.started === 'undefined') { - options.started = false; - } - - if (typeof options.subscriptions === 'undefined') { - options.subscriptions = {}; - } //GENERATED_OPTIONS_INIT_END //CUSTOM_OPTIONS_INIT_START @@ -122,67 +96,12 @@ class SystemSocket extends System { //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 - - /** - * start() - * - Starts a transient system by registering subscriptions to Events - */ - start() { - - //GENERATED_START_METHOD_START - - //GENERATED_EVENT_LISTENERS_START_START - //GENERATED_EVENT_LISTENERS_START_END - - //CUSTOM_BEFORE_SYSTEM_START_START - //CUSTOM_BEFORE_SYSTEM_START_END - - this.started = true; - - console.log('Started transient system: SystemSocket'); - //GENERATED_START_METHOD_END - - //CUSTOM_START_METHOD_START - //CUSTOM_START_METHOD_END - - } - - /** - * stop() - * - Stops a transient system to by removing subscriptions to Events - */ - stop() { - - //GENERATED_STOP_METHOD_START - - //GENERATED_EVENT_LISTENERS_STOP_START - //GENERATED_EVENT_LISTENERS_STOP_END - - //CUSTOM_BEFORE_SYSTEM_STOP_START - //CUSTOM_BEFORE_SYSTEM_STOP_END - - this.started = false; - - console.log('Stopped transient system: SystemSocket'); - //GENERATED_STOP_METHOD_END - - //CUSTOM_STOP_METHOD_START - console.log('system socket stop test'); - //CUSTOM_STOP_METHOD_END - - } //GENERATED_METHODS_END //GENERATED_STATIC_METHODS_START diff --git a/src/r3/r3-system/r3-system.js b/src/r3/r3-system/r3-system.js index b3cc3ec..263adc2 100644 --- a/src/r3/r3-system/r3-system.js +++ b/src/r3/r3-system/r3-system.js @@ -4,13 +4,9 @@ const Utils = require('.././r3-utils'); /** CUSTOM_OPTIONS_START - started=false - subscriptions={} CUSTOM_OPTIONS_END CUSTOM_STATIC_OPTIONS_START - Started=false - Subscriptions={} CUSTOM_STATIC_OPTIONS_END CUSTOM_EVENT_LISTENERS_START @@ -20,7 +16,6 @@ const Utils = require('.././r3-utils'); CUSTOM_STATIC_EVENT_LISTENERS_END CUSTOM_METHODS_START - initialized() CUSTOM_METHODS_END CUSTOM_STATIC_METHODS_START @@ -33,27 +28,11 @@ class System { //GENERATED_CONSTRUCTOR_START constructor(options) { - Event.Emit(Event.OBJECT_CREATED, this); - if (typeof options === 'undefined') { options = {}; } - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - //GENERATED_OPTIONS_INIT_START - - if (typeof options.started === 'undefined') { - options.started = false; - } - - if (typeof options.subscriptions === 'undefined') { - options.subscriptions = {}; - } //GENERATED_OPTIONS_INIT_END //CUSTOM_OPTIONS_INIT_START @@ -64,34 +43,12 @@ class System { //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_END //GENERATED_METHODS_START - - /** - * initialized() - * - No comment - */ - 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 @@ -109,8 +66,6 @@ class System { } //GENERATED_STATIC_OPTIONS_INIT_START -System.Started = false; -System.Subscriptions = {}; //GENERATED_STATIC_OPTIONS_INIT_END //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START diff --git a/src/r3/r3-utils.js b/src/r3/r3-utils.js index 95a8501..cb35454 100644 --- a/src/r3/r3-utils.js +++ b/src/r3/r3-utils.js @@ -10,6 +10,7 @@ const Event = require('./r3-event'); CUSTOM_OPTIONS_END CUSTOM_METHODS_START + initialized() - Should raise an event(s) which indicates that this object initialized CUSTOM_METHODS_END CUSTOM_STATIC_METHODS_START @@ -1292,6 +1293,25 @@ class Utils { //CUSTOM_IMPLEMENTATION_END //GENERATED_METHODS_START + + /** + * initialized() + * - Should raise an event(s) which indicates that this object initialized + */ + initialized() { + + //GENERATED_INITIALIZED_METHOD_START + if (this.hasOwnProperty('callDepth')) { + delete this.callDepth; + } else { + console.warn('Multiple calls to initialized() - check your callstack'); + } + //GENERATED_INITIALIZED_METHOD_END + + //CUSTOM_INITIALIZED_METHOD_START + //CUSTOM_INITIALIZED_METHOD_END + + } //GENERATED_METHODS_END //GENERATED_STATIC_METHODS_START diff --git a/src/templates/initialized.template b/src/templates/initialized.template index 36bf010..1fc40bc 100644 --- a/src/templates/initialized.template +++ b/src/templates/initialized.template @@ -1,2 +1,5 @@ - Event.Emit(Event.OBJECT_INITIALIZED, this); - delete this.callDepth; \ No newline at end of file + if (this.hasOwnProperty('callDepth')) { + delete this.callDepth; + } else { + console.warn('Multiple calls to initialized() - check your callstack'); + } \ No newline at end of file diff --git a/src/templates/normal.template b/src/templates/normal.template index 6905eb6..db93a65 100644 --- a/src/templates/normal.template +++ b/src/templates/normal.template @@ -11,6 +11,7 @@ const Utils = require('INCLUDE_PATH/r3-utils'); CUSTOM_OPTIONS_END CUSTOM_METHODS_START + initialized() - Should raise an event(s) which indicates that this object initialized CUSTOM_METHODS_END CUSTOM_STATIC_METHODS_START diff --git a/src/templates/r3-base.template b/src/templates/r3-base.template deleted file mode 100644 index e634874..0000000 --- a/src/templates/r3-base.template +++ /dev/null @@ -1,15 +0,0 @@ -class R3 { - static version = 'VERSION'; - static compileDate = 'DATE'; -} - -//GENERATED_IMPORTS_START -//GENERATED_IMPORTS_END - -//GENERATED_DEFINES_START -//GENERATED_DEFINES_END - -//CUSTOM_CONVENIENT_DEFINES_START -//CUSTOM_CONVENIENT_DEFINES_END - -module.exports = R3; diff --git a/src/templates/system-base.template b/src/templates/system-base.template deleted file mode 100644 index f8753ec..0000000 --- a/src/templates/system-base.template +++ /dev/null @@ -1,62 +0,0 @@ -const Event = require('INCLUDE_PATH/r3-event'); -const Utils = require('INCLUDE_PATH/r3-utils'); - -/** - - CUSTOM_OPTIONS_START - started=false - subscriptions={} - CUSTOM_OPTIONS_END - - CUSTOM_STATIC_OPTIONS_START - Started=false - Subscriptions={} - CUSTOM_STATIC_OPTIONS_END - - CUSTOM_EVENT_LISTENERS_START - CUSTOM_EVENT_LISTENERS_END - - CUSTOM_STATIC_EVENT_LISTENERS_START - CUSTOM_STATIC_EVENT_LISTENERS_END - - CUSTOM_METHODS_START - initialized() - CUSTOM_METHODS_END - - CUSTOM_STATIC_METHODS_START - CUSTOM_STATIC_METHODS_END - - **/ - -class CLASS_NAME { - - //GENERATED_CONSTRUCTOR_START - //GENERATED_CONSTRUCTOR_END - - //GENERATED_METHODS_START - //GENERATED_METHODS_END - - //GENERATED_STATIC_METHODS_START - //GENERATED_STATIC_METHODS_END - - //GENERATED_EVENT_LISTENER_METHODS_START - //GENERATED_EVENT_LISTENER_METHODS_END - - //GENERATED_STATIC_EVENT_LISTENER_METHODS_START - //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 = CLASS_NAME; diff --git a/src/templates/system.template b/src/templates/system.template deleted file mode 100644 index 9542af8..0000000 --- a/src/templates/system.template +++ /dev/null @@ -1,70 +0,0 @@ -const Event = require('INCLUDE_PATH/r3-event'); -const Utils = require('INCLUDE_PATH/r3-utils'); -const EXTEND_CLASS = require('./EXTEND_CLASS_FILE_NAME'); - -/** - - GENERATED_INHERITED_START - - GENERATED_INHERITED_END - - CUSTOM_OPTIONS_START - started=false - subscriptions={} - CUSTOM_OPTIONS_END - - CUSTOM_STATIC_OPTIONS_START - Started=false - Subscriptions={} - CUSTOM_STATIC_OPTIONS_END - - CUSTOM_EVENT_LISTENERS_START - CUSTOM_EVENT_LISTENERS_END - - CUSTOM_STATIC_EVENT_LISTENERS_START - CUSTOM_STATIC_EVENT_LISTENERS_END - - CUSTOM_METHODS_START - start() - Starts a transient system by registering subscriptions to Events - stop() - Stops a transient system to by removing subscriptions to Events - CUSTOM_METHODS_END - - CUSTOM_STATIC_METHODS_START - Start(options) - Starts the system by registering subscriptions to events - Stop(options) - Stops the system by removing these subscriptions to events - CUSTOM_STATIC_METHODS_END - - **/ - -class CLASS_NAME extends EXTEND_CLASS { - - //GENERATED_CONSTRUCTOR_EXTENDS_START - //GENERATED_CONSTRUCTOR_EXTENDS_END - - //GENERATED_METHODS_START - //GENERATED_METHODS_END - - //GENERATED_STATIC_METHODS_START - //GENERATED_STATIC_METHODS_END - - //GENERATED_EVENT_LISTENER_METHODS_START - //GENERATED_EVENT_LISTENER_METHODS_END - - //GENERATED_STATIC_EVENT_LISTENER_METHODS_START - //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 = CLASS_NAME; diff --git a/src/templates/token.db b/src/templates/token.db index f9d4b2a..ef8576f 100644 --- a/src/templates/token.db +++ b/src/templates/token.db @@ -21,7 +21,6 @@ GENERATED_METHOD_NAME_UPPERCASE_METHOD GENERATED_METHODS GENERATED_OPTIONS_INIT GENERATED_OUT_OF_CLASS_IMPLEMENTATION -GENERATED_START_METHOD GENERATED_STATIC_ASYNC_METHOD GENERATED_STATIC_EMIT_METHOD GENERATED_STATIC_EVENT_LISTENER_METHODS @@ -47,7 +46,6 @@ GENERATED_STATIC_OPTIONS_INIT GENERATED_STATIC_START_METHOD GENERATED_STATIC_STOP_METHOD GENERATED_STATIC_SUBSCRIBE_METHOD -GENERATED_STOP_METHOD GENERATED_SUBSCRIBE_METHOD GENERATED_UPDATE_FROM_INSTANCE_METHOD GENERATED_UPDATE_FROM_INSTANCE_OPTIONS @@ -77,7 +75,6 @@ CUSTOM_METHODS CUSTOM_OPTIONS CUSTOM_OPTIONS_INIT CUSTOM_OUT_OF_CLASS_IMPLEMENTATION -CUSTOM_START_METHOD CUSTOM_STATIC_ASYNC_METHOD CUSTOM_STATIC_EMIT_METHOD CUSTOM_STATIC_EVENT_LISTENERS @@ -101,6 +98,5 @@ CUSTOM_STATIC_OPTIONS CUSTOM_STATIC_START_METHOD CUSTOM_STATIC_STOP_METHOD CUSTOM_STATIC_SUBSCRIBE_METHOD -CUSTOM_STOP_METHOD CUSTOM_SUBSCRIBE_METHOD CUSTOM_UPDATE_FROM_INSTANCE_METHOD diff --git a/version b/version index c884a2f..9b67bea 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.0.440 \ No newline at end of file +2.0.448 \ No newline at end of file