From 7c12d4efdd5fdaf6efc1eff546001fdaf972e6bf Mon Sep 17 00:00:00 2001 From: "Theunis J. Botha" Date: Wed, 8 Sep 2021 05:08:48 +0200 Subject: [PATCH] fix callDepth --- .r3_history | 1 - dist/r3.js | 189 ++----------- package.json | 2 +- src/r3/index.js | 1 - src/r3/r3-component/r3-component.js | 2 +- src/r3/r3-component/r3-image.js | 2 +- src/r3/r3-component/r3-input.js | 2 +- src/r3/r3-component/r3-touch.js | 2 +- src/r3/r3-event.js | 2 +- src/r3/r3-project.js | 2 +- src/r3/r3-r3-object.js | 3 +- src/r3/r3-r3.js | 6 +- src/r3/r3-runtime/r3-bullet.js | 2 +- src/r3/r3-runtime/r3-code-mirror.js | 2 +- src/r3/r3-runtime/r3-coder.js | 2 +- src/r3/r3-runtime/r3-control-kit.js | 2 +- src/r3/r3-runtime/r3-default.js | 2 +- src/r3/r3-runtime/r3-g-u-i.js | 2 +- src/r3/r3-runtime/r3-graphics.js | 2 +- src/r3/r3-runtime/r3-physics.js | 2 +- src/r3/r3-runtime/r3-runtime.js | 2 +- src/r3/r3-runtime/r3-socket.js | 2 +- src/r3/r3-runtime/r3-statistics.js | 2 +- src/r3/r3-runtime/r3-stats.js | 2 +- src/r3/r3-runtime/r3-three.js | 2 +- src/r3/r3-system/index.js | 4 +- src/r3/r3-system/r3-system-input.js | 2 +- src/r3/r3-system/r3-system-linking.js | 2 +- src/r3/r3-system/r3-system-socket.js | 2 +- src/r3/r3-system/r3-system-test.js | 248 ------------------ src/r3/r3-system/r3-system.js | 4 +- src/r3/r3-utils.js | 2 +- src/templates/constructor.template | 2 +- src/templates/constructor_extends.template | 2 +- .../generated_custom_options_init.template | 1 + version | 2 +- 36 files changed, 64 insertions(+), 447 deletions(-) delete mode 100644 src/r3/r3-system/r3-system-test.js diff --git a/.r3_history b/.r3_history index 5f7d84e..df4c070 100644 --- a/.r3_history +++ b/.r3_history @@ -6,7 +6,6 @@ r3 create Project extends R3Object r3 create System system-base r3 create SystemSocket system r3 create SystemLinking system -r3 create SystemTest system r3 create Component extends R3Object ./r3-component/ r3 create Image extends Component ./r3-component/ r3 create SystemInput system diff --git a/dist/r3.js b/dist/r3.js index 8367a9d..f83baa1 100644 --- a/dist/r3.js +++ b/dist/r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.199'; - static compileDate = '2021 Sep 08 - 04:57:21 am'; + static version = '2.0.202'; + static compileDate = '2021 Sep 08 - 05:07:45 am'; } /** @@ -29,6 +29,7 @@ class System { if (typeof options.started === 'undefined') { options.started = false; } + if (typeof options.subscriptions === 'undefined') { options.subscriptions = {}; } @@ -37,8 +38,8 @@ class System { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -69,8 +70,8 @@ class Event { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -371,8 +372,8 @@ class Utils { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -1681,8 +1682,8 @@ class SystemInput extends System { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -1991,8 +1992,8 @@ class SystemLinking extends System { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -2159,8 +2160,8 @@ class SystemSocket extends System { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -2224,138 +2225,6 @@ class SystemSocket extends System { } -/** - - Class R3.System.Test - [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 SystemTest] - - Properties: - - - - Static Properties: - - - - Methods: - - - start(options) - Just calls System.Start(options) - - - stop(options) - Just calls System.Stop(options) - - Static Methods: - - - Start(options) - Starts the system by registering subscriptions to events - - - Stop(options) - Stops the system by removing these subscriptions to events - - **/ - -class SystemTest 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) { - Event.Emit(Event.OBJECT_INITIALIZED); - } else { - delete this.callDepth; - options.callDepth--; - } - - } - - /** - * start() - * - Just calls System.Start(options) - * @param options - */ - start(options) { - - this.started = true; - - console.log('Started transient system: SystemTest'); - - } - - /** - * stop() - * - Just calls System.Stop(options) - * @param options - */ - stop(options) { - - this.started = false; - - console.log('Stopped transient system: SystemTest'); - - } - - /** - * Start() - * - Starts the system by registering subscriptions to events - * @param options - */ - static Start(options) { - - SystemTest.Started = true; - - console.log('Started system: SystemTest'); - - } - - /** - * Stop() - * - Stops the system by removing these subscriptions to events - * @param options - */ - static Stop(options) { - - SystemTest.Started = false; - - console.log('Stopped system: SystemTest'); - - } - -} - /** Class R3.Event.Runtime @@ -2435,8 +2304,8 @@ class Runtime extends Event { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -2527,8 +2396,8 @@ class R3Object extends Event { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -2633,8 +2502,8 @@ class Coder extends Runtime { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -2739,8 +2608,8 @@ class Default extends Runtime { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -2845,8 +2714,8 @@ class GUI extends Runtime { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -2951,8 +2820,8 @@ class Graphics extends Runtime { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -3057,8 +2926,8 @@ class Physics extends Runtime { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -3163,8 +3032,8 @@ class Socket extends Runtime { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -3269,8 +3138,8 @@ class Statistics extends Runtime { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -3388,8 +3257,8 @@ class Component extends R3Object { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -3570,8 +3439,8 @@ class Project extends R3Object { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -3694,8 +3563,8 @@ class CodeMirror extends Coder { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -3818,8 +3687,8 @@ class ControlKit extends GUI { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -3942,8 +3811,8 @@ class Three extends Graphics { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -4066,8 +3935,8 @@ class Bullet extends Physics { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -4190,8 +4059,8 @@ class Stats extends Statistics { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -4327,8 +4196,8 @@ class Image extends Component { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -4464,8 +4333,8 @@ class Input extends Component { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -4620,8 +4489,8 @@ class Touch extends Input { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } @@ -4633,7 +4502,6 @@ R3.System = System; R3.System.Input = SystemInput; R3.System.Linking = SystemLinking; R3.System.Socket = SystemSocket; -R3.System.Test = SystemTest; R3.Event = Event; R3.Event.Runtime = Runtime; R3.Event.Coder = Coder; @@ -4696,5 +4564,4 @@ console.log('r3.js - version ' + R3.version + ' compiled ' + R3.compileDate); R3.System.Input.Start(); R3.System.Linking.Start(); R3.System.Socket.Start(); -R3.System.Test.Start(); diff --git a/package.json b/package.json index 585ee57..1287a79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "r3", - "version" : "2.0.199", + "version" : "2.0.202", "description": "", "private": true, "dependencies": { diff --git a/src/r3/index.js b/src/r3/index.js index 79b05cf..bc3006a 100644 --- a/src/r3/index.js +++ b/src/r3/index.js @@ -10,7 +10,6 @@ console.log('r3.js - version ' + R3.version + ' compiled ' + R3.compileDate); R3.System.Input.Start(); R3.System.Linking.Start(); R3.System.Socket.Start(); -R3.System.Test.Start(); //GENERATED_INDEX_BODY_END module.exports = { diff --git a/src/r3/r3-component/r3-component.js b/src/r3/r3-component/r3-component.js index 57f7625..906be61 100644 --- a/src/r3/r3-component/r3-component.js +++ b/src/r3/r3-component/r3-component.js @@ -149,8 +149,8 @@ class Component extends R3Object { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-component/r3-image.js b/src/r3/r3-component/r3-image.js index f665369..85e3ab4 100644 --- a/src/r3/r3-component/r3-image.js +++ b/src/r3/r3-component/r3-image.js @@ -162,8 +162,8 @@ class Image extends Component { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-component/r3-input.js b/src/r3/r3-component/r3-input.js index b71845b..d0c460c 100644 --- a/src/r3/r3-component/r3-input.js +++ b/src/r3/r3-component/r3-input.js @@ -162,8 +162,8 @@ class Input extends Component { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-component/r3-touch.js b/src/r3/r3-component/r3-touch.js index 48970c1..719eb05 100644 --- a/src/r3/r3-component/r3-touch.js +++ b/src/r3/r3-component/r3-touch.js @@ -180,8 +180,8 @@ class Touch extends Input { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-event.js b/src/r3/r3-event.js index e851fc0..72795a1 100644 --- a/src/r3/r3-event.js +++ b/src/r3/r3-event.js @@ -53,8 +53,8 @@ class Event { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-project.js b/src/r3/r3-project.js index b1e2cd1..27fa99a 100644 --- a/src/r3/r3-project.js +++ b/src/r3/r3-project.js @@ -131,8 +131,8 @@ class Project extends R3Object { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-r3-object.js b/src/r3/r3-r3-object.js index fcb5eff..4d161c7 100644 --- a/src/r3/r3-r3-object.js +++ b/src/r3/r3-r3-object.js @@ -101,6 +101,7 @@ class R3Object extends Event { super(options); //GENERATED_OPTIONS_INIT_START + if (typeof options.register === 'undefined') { options.register = true; } @@ -116,8 +117,8 @@ class R3Object extends Event { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-r3.js b/src/r3/r3-r3.js index 5dc0868..5aa6840 100644 --- a/src/r3/r3-r3.js +++ b/src/r3/r3-r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.199'; - static compileDate = '2021 Sep 08 - 04:57:21 am'; + static version = '2.0.202'; + static compileDate = '2021 Sep 08 - 05:07:45 am'; } //GENERATED_IMPORTS_START @@ -10,7 +10,6 @@ const Utils = require('./r3-utils.js'); const SystemInput = require('./r3-system/r3-system-input.js'); const SystemLinking = require('./r3-system/r3-system-linking.js'); const SystemSocket = require('./r3-system/r3-system-socket.js'); -const SystemTest = require('./r3-system/r3-system-test.js'); const Runtime = require('./r3-runtime/r3-runtime.js'); const R3Object = require('./r3-r3-object.js'); const Coder = require('./r3-runtime/r3-coder.js'); @@ -37,7 +36,6 @@ R3.System = System; R3.System.Input = SystemInput; R3.System.Linking = SystemLinking; R3.System.Socket = SystemSocket; -R3.System.Test = SystemTest; R3.Event = Event; R3.Event.Runtime = Runtime; R3.Event.Coder = Coder; diff --git a/src/r3/r3-runtime/r3-bullet.js b/src/r3/r3-runtime/r3-bullet.js index 641d27b..52787b8 100644 --- a/src/r3/r3-runtime/r3-bullet.js +++ b/src/r3/r3-runtime/r3-bullet.js @@ -149,8 +149,8 @@ class Bullet extends Physics { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-code-mirror.js b/src/r3/r3-runtime/r3-code-mirror.js index 269f220..462d359 100644 --- a/src/r3/r3-runtime/r3-code-mirror.js +++ b/src/r3/r3-runtime/r3-code-mirror.js @@ -149,8 +149,8 @@ class CodeMirror extends Coder { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-coder.js b/src/r3/r3-runtime/r3-coder.js index 5627dad..96b923a 100644 --- a/src/r3/r3-runtime/r3-coder.js +++ b/src/r3/r3-runtime/r3-coder.js @@ -131,8 +131,8 @@ class Coder extends Runtime { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-control-kit.js b/src/r3/r3-runtime/r3-control-kit.js index 0114741..3baf25d 100644 --- a/src/r3/r3-runtime/r3-control-kit.js +++ b/src/r3/r3-runtime/r3-control-kit.js @@ -149,8 +149,8 @@ class ControlKit extends GUI { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-default.js b/src/r3/r3-runtime/r3-default.js index 05a5f79..2165d4a 100644 --- a/src/r3/r3-runtime/r3-default.js +++ b/src/r3/r3-runtime/r3-default.js @@ -131,8 +131,8 @@ class Default extends Runtime { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } 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 ebfc270..ae77807 100644 --- a/src/r3/r3-runtime/r3-g-u-i.js +++ b/src/r3/r3-runtime/r3-g-u-i.js @@ -131,8 +131,8 @@ class GUI extends Runtime { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-graphics.js b/src/r3/r3-runtime/r3-graphics.js index fea54cf..87c292b 100644 --- a/src/r3/r3-runtime/r3-graphics.js +++ b/src/r3/r3-runtime/r3-graphics.js @@ -131,8 +131,8 @@ class Graphics extends Runtime { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-physics.js b/src/r3/r3-runtime/r3-physics.js index 162bd1e..42d4fba 100644 --- a/src/r3/r3-runtime/r3-physics.js +++ b/src/r3/r3-runtime/r3-physics.js @@ -131,8 +131,8 @@ class Physics extends Runtime { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-runtime.js b/src/r3/r3-runtime/r3-runtime.js index b9acad4..a93d88b 100644 --- a/src/r3/r3-runtime/r3-runtime.js +++ b/src/r3/r3-runtime/r3-runtime.js @@ -112,8 +112,8 @@ class Runtime extends Event { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-socket.js b/src/r3/r3-runtime/r3-socket.js index ddbf8ed..9b00270 100644 --- a/src/r3/r3-runtime/r3-socket.js +++ b/src/r3/r3-runtime/r3-socket.js @@ -131,8 +131,8 @@ class Socket extends Runtime { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-statistics.js b/src/r3/r3-runtime/r3-statistics.js index 13a4b78..c290bfa 100644 --- a/src/r3/r3-runtime/r3-statistics.js +++ b/src/r3/r3-runtime/r3-statistics.js @@ -131,8 +131,8 @@ class Statistics extends Runtime { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-stats.js b/src/r3/r3-runtime/r3-stats.js index 888f96f..5e11681 100644 --- a/src/r3/r3-runtime/r3-stats.js +++ b/src/r3/r3-runtime/r3-stats.js @@ -149,8 +149,8 @@ class Stats extends Statistics { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-runtime/r3-three.js b/src/r3/r3-runtime/r3-three.js index 47df66a..9b8b033 100644 --- a/src/r3/r3-runtime/r3-three.js +++ b/src/r3/r3-runtime/r3-three.js @@ -149,8 +149,8 @@ class Three extends Graphics { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-system/index.js b/src/r3/r3-system/index.js index df2ac04..1544a12 100644 --- a/src/r3/r3-system/index.js +++ b/src/r3/r3-system/index.js @@ -3,7 +3,6 @@ const System = require('./r3-system.js'); const SystemInput = require('./r3-system-input.js'); const SystemLinking = require('./r3-system-linking.js'); const SystemSocket = require('./r3-system-socket.js'); -const SystemTest = require('./r3-system-test.js'); //GENERATED_IMPORTS_END //GENERATED_INDEX_BODY_START @@ -14,7 +13,6 @@ module.exports = { System, SystemInput, SystemLinking, - SystemSocket, - SystemTest + SystemSocket //GENERATED_EXPORTS_END } diff --git a/src/r3/r3-system/r3-system-input.js b/src/r3/r3-system/r3-system-input.js index 49f6040..5943fbb 100644 --- a/src/r3/r3-system/r3-system-input.js +++ b/src/r3/r3-system/r3-system-input.js @@ -119,8 +119,8 @@ class SystemInput extends System { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-system/r3-system-linking.js b/src/r3/r3-system/r3-system-linking.js index db7402b..a65c6eb 100644 --- a/src/r3/r3-system/r3-system-linking.js +++ b/src/r3/r3-system/r3-system-linking.js @@ -111,8 +111,8 @@ class SystemLinking extends System { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-system/r3-system-socket.js b/src/r3/r3-system/r3-system-socket.js index a3f85cc..c36ad78 100644 --- a/src/r3/r3-system/r3-system-socket.js +++ b/src/r3/r3-system/r3-system-socket.js @@ -109,8 +109,8 @@ class SystemSocket extends System { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-system/r3-system-test.js b/src/r3/r3-system/r3-system-test.js deleted file mode 100644 index 985d6e9..0000000 --- a/src/r3/r3-system/r3-system-test.js +++ /dev/null @@ -1,248 +0,0 @@ -const Event = require('.././r3-event'); -const Utils = require('.././r3-utils'); -const System = require('./r3-system.js'); - -/** - - GENERATED_INHERITED_START - - Class R3.System.Test - [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 SystemTest] - - Properties: - - - - Static Properties: - - - - Methods: - - - start(options) - Just calls System.Start(options) - - - stop(options) - Just calls System.Stop(options) - - Static Methods: - - - Start(options) - Starts the system by registering subscriptions to events - - - Stop(options) - 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 - CUSTOM_STATIC_EVENT_LISTENERS_END - - CUSTOM_METHODS_START - start(options) - Just calls System.Start(options) - stop(options) - Just calls System.Stop(options) - 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 SystemTest 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) { - Event.Emit(Event.OBJECT_INITIALIZED); - } else { - delete this.callDepth; - options.callDepth--; - } - - //CUSTOM_AFTER_INIT_START - //CUSTOM_AFTER_INIT_END - } - //GENERATED_CONSTRUCTOR_EXTENDS_END - - //GENERATED_METHODS_START - - /** - * start() - * - Just calls System.Start(options) - * @param options - */ - start(options) { - - //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: SystemTest'); - //GENERATED_START_METHOD_END - - //CUSTOM_START_METHOD_START - //CUSTOM_START_METHOD_END - - } - - /** - * stop() - * - Just calls System.Stop(options) - * @param options - */ - stop(options) { - - //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: SystemTest'); - //GENERATED_STOP_METHOD_END - - //CUSTOM_STOP_METHOD_START - //CUSTOM_STOP_METHOD_END - - } - //GENERATED_METHODS_END - - //GENERATED_STATIC_METHODS_START - - /** - * Start() - * - Starts the system by registering subscriptions to events - * @param options - */ - static Start(options) { - - //GENERATED_STATIC_START_METHOD_START - - //GENERATED_STATIC_EVENT_LISTENERS_START_START - - //GENERATED_STATIC_EVENT_LISTENERS_START_END - - //CUSTOM_BEFORE_STATIC_SYSTEM_START_START - //CUSTOM_BEFORE_STATIC_SYSTEM_START_END - - SystemTest.Started = true; - - console.log('Started system: SystemTest'); - - //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 - * @param options - */ - static Stop(options) { - - //GENERATED_STATIC_STOP_METHOD_START - - //GENERATED_STATIC_EVENT_LISTENERS_STOP_START - //GENERATED_STATIC_EVENT_LISTENERS_STOP_END - - //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_START - //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_END - - SystemTest.Started = false; - - console.log('Stopped system: SystemTest'); - - //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 - //GENERATED_STATIC_EVENT_LISTENER_METHODS_END - - //CUSTOM_IMPLEMENTATION_START - //CUSTOM_IMPLEMENTATION_END - -} - -//GENERATED_STATIC_OPTIONS_INIT_START -//GENERATED_STATIC_OPTIONS_INIT_END - -//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START -//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END - -module.exports = SystemTest; diff --git a/src/r3/r3-system/r3-system.js b/src/r3/r3-system/r3-system.js index 5a5c26e..3599f89 100644 --- a/src/r3/r3-system/r3-system.js +++ b/src/r3/r3-system/r3-system.js @@ -45,9 +45,11 @@ class System { } //GENERATED_OPTIONS_INIT_START + if (typeof options.started === 'undefined') { options.started = false; } + if (typeof options.subscriptions === 'undefined') { options.subscriptions = {}; } @@ -63,8 +65,8 @@ class System { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/r3/r3-utils.js b/src/r3/r3-utils.js index 8ebf26d..92d817a 100644 --- a/src/r3/r3-utils.js +++ b/src/r3/r3-utils.js @@ -47,8 +47,8 @@ class Utils { if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/templates/constructor.template b/src/templates/constructor.template index 8f5b050..c6c699b 100644 --- a/src/templates/constructor.template +++ b/src/templates/constructor.template @@ -25,8 +25,8 @@ if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/templates/constructor_extends.template b/src/templates/constructor_extends.template index a8d7744..f6720fb 100644 --- a/src/templates/constructor_extends.template +++ b/src/templates/constructor_extends.template @@ -25,8 +25,8 @@ if (options.callDepth === 0) { Event.Emit(Event.OBJECT_INITIALIZED); - } else { delete this.callDepth; + } else { options.callDepth--; } diff --git a/src/templates/generated_custom_options_init.template b/src/templates/generated_custom_options_init.template index e44bbd6..d2ba84b 100644 --- a/src/templates/generated_custom_options_init.template +++ b/src/templates/generated_custom_options_init.template @@ -1,3 +1,4 @@ + if (typeof options.KEY === 'undefined') { options.KEY = VALUE; } diff --git a/version b/version index 4745a94..7835115 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.0.199 \ No newline at end of file +2.0.202 \ No newline at end of file