From 73ab31fa06fc2498e042fd7ab69434b39b086076 Mon Sep 17 00:00:00 2001 From: "Theunis J. Botha" Date: Mon, 6 Sep 2021 12:11:06 +0200 Subject: [PATCH] before implement transient events --- dist/r3.js | 186 +++++------------- package.json | 2 +- r3.php | 18 +- src/r3/r3-r3.js | 4 +- src/r3/r3-system/r3-system-input.js | 79 +++++--- src/r3/r3-system/r3-system-linking.js | 66 ++++--- src/r3/r3-system/r3-system-socket.js | 62 +++--- src/r3/r3-system/r3-system-test.js | 62 +++--- src/r3/r3-system/r3-system.js | 98 ++------- ...ted_static_event_listeners_start.template} | 0 ...ated_static_event_listeners_stop.template} | 0 src/templates/start.template | 12 +- src/templates/static_start.template | 11 +- src/templates/static_stop.template | 13 +- src/templates/stop.template | 12 +- src/templates/system-base.template | 12 ++ src/templates/system.template | 10 +- src/templates/token.db | 8 + version | 2 +- 19 files changed, 290 insertions(+), 367 deletions(-) rename src/templates/{generated_event_listeners_start.template => generated_static_event_listeners_start.template} (100%) rename src/templates/{generated_event_listeners_stop.template => generated_static_event_listeners_stop.template} (100%) diff --git a/dist/r3.js b/dist/r3.js index 3162356..a23d857 100644 --- a/dist/r3.js +++ b/dist/r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.146'; - static compileDate = '2021 Sep 06 - 09:39:38 am'; + static version = '2.0.158'; + static compileDate = '2021 Sep 06 - 12:10:13 pm'; } /** @@ -33,58 +33,6 @@ class System { } - /** - * start() - * - Starts a transient system by registering subscriptions to events - */ - start() { - - System.Start(); - this.started = true; - - } - - /** - * stop() - * - Starts a transient by registering subscriptions to events - */ - stop() { - - System.Stop(); - this.started = false; - - } - - /** - * Start() - * - Starts the global system by registering subscriptions to events - */ - static Start() { - - if ('System' !== 'System') { - System.Start(); - } - - System.Started = true; - - console.log('Started System'); - - } - - /** - * Stop() - * - Stops the global system by removing these subscriptions to events - */ - static Stop() { - - console.log('Stopped System'); - - if ('System' !== 'System') { - System.Stop(); - } - - } - } System.Started = false; @@ -1637,19 +1585,11 @@ class Utils { Inherited Methods: - - start() - Starts a transient system by registering subscriptions to events - - - stop() - Starts a transient by registering subscriptions to events + Inherited Static Methods: - - Start() - Starts the global system by registering subscriptions to events - - - Stop() - Stops the global system by removing these subscriptions to events + [Belonging to SystemInput] @@ -1664,10 +1604,10 @@ class Utils { Methods: - start() - Just calls System.Start() + Starts a transient system by registering subscriptions to Events - stop() - Just calls System.Stop() + Stops a transient system to by removing subscriptions to Events Static Methods: @@ -1699,24 +1639,28 @@ class SystemInput extends System { /** * start() - * - Just calls System.Start() + * - Starts a transient system by registering subscriptions to Events */ start() { - SystemInput.Start(); + console.log('Test for custom start before'); + this.started = true; + console.log('Started transient system: SystemInput'); + } /** * stop() - * - Just calls System.Stop() + * - Stops a transient system to by removing subscriptions to Events */ stop() { - SystemInput.Stop(); this.started = false; + console.log('Stopped transient system: SystemInput'); + } /** @@ -1725,10 +1669,6 @@ class SystemInput extends System { */ static Start() { - if ('System' !== 'SystemInput') { - System.Start(); - } - SystemInput.Subscriptions.push( new Event.Subscribe( Event.TOUCH_START, @@ -1792,7 +1732,7 @@ class SystemInput extends System { SystemInput.Started = true; - console.log('Started SystemInput'); + console.log('Started system: SystemInput'); } @@ -1902,11 +1842,9 @@ class SystemInput extends System { [] ); - console.log('Stopped SystemInput'); + SystemInput.Started = false; - if ('System' !== 'SystemInput') { - System.Stop(); - } + console.log('Stopped system: SystemInput'); } @@ -2029,19 +1967,11 @@ class SystemInput extends System { Inherited Methods: - - start() - Starts a transient system by registering subscriptions to events - - - stop() - Starts a transient by registering subscriptions to events + Inherited Static Methods: - - Start() - Starts the global system by registering subscriptions to events - - - Stop() - Stops the global system by removing these subscriptions to events + [Belonging to SystemLinking] @@ -2096,9 +2026,10 @@ class SystemLinking extends System { */ start(options) { - SystemLinking.Start(); this.started = true; + console.log('Started transient system: SystemLinking'); + } /** @@ -2108,9 +2039,10 @@ class SystemLinking extends System { */ stop(options) { - SystemLinking.Stop(); this.started = false; + console.log('Stopped transient system: SystemLinking'); + } /** @@ -2120,10 +2052,6 @@ class SystemLinking extends System { */ static Start(options) { - if ('System' !== 'SystemLinking') { - System.Start(); - } - SystemLinking.Subscriptions.push( new Event.Subscribe( Event.OBJECT_CREATED, @@ -2139,7 +2067,7 @@ class SystemLinking extends System { SystemLinking.Started = true; - console.log('Started SystemLinking'); + console.log('Started system: SystemLinking'); } @@ -2170,11 +2098,9 @@ class SystemLinking extends System { [] ); - console.log('Stopped SystemLinking'); + SystemLinking.Started = false; - if ('System' !== 'SystemLinking') { - System.Stop(); - } + console.log('Stopped system: SystemLinking'); } @@ -2217,19 +2143,11 @@ class SystemLinking extends System { Inherited Methods: - - start() - Starts a transient system by registering subscriptions to events - - - stop() - Starts a transient by registering subscriptions to events + Inherited Static Methods: - - Start() - Starts the global system by registering subscriptions to events - - - Stop() - Stops the global system by removing these subscriptions to events + [Belonging to SystemSocket] @@ -2284,9 +2202,10 @@ class SystemSocket extends System { */ start(options) { - SystemSocket.Start(); this.started = true; + console.log('Started transient system: SystemSocket'); + } /** @@ -2296,9 +2215,10 @@ class SystemSocket extends System { */ stop(options) { - SystemSocket.Stop(); this.started = false; + console.log('Stopped transient system: SystemSocket'); + console.log('system socket stop test'); } @@ -2310,13 +2230,9 @@ class SystemSocket extends System { */ static Start(options) { - if ('System' !== 'SystemSocket') { - System.Start(); - } - SystemSocket.Started = true; - console.log('Started SystemSocket'); + console.log('Started system: SystemSocket'); console.log('CUSTOM Start Test Stuff'); @@ -2329,11 +2245,9 @@ class SystemSocket extends System { */ static Stop(options) { - console.log('Stopped SystemSocket'); + SystemSocket.Started = false; - if ('System' !== 'SystemSocket') { - System.Stop(); - } + console.log('Stopped system: SystemSocket'); } @@ -2356,19 +2270,11 @@ class SystemSocket extends System { Inherited Methods: - - start() - Starts a transient system by registering subscriptions to events - - - stop() - Starts a transient by registering subscriptions to events + Inherited Static Methods: - - Start() - Starts the global system by registering subscriptions to events - - - Stop() - Stops the global system by removing these subscriptions to events + [Belonging to SystemTest] @@ -2423,9 +2329,10 @@ class SystemTest extends System { */ start(options) { - SystemTest.Start(); this.started = true; + console.log('Started transient system: SystemTest'); + } /** @@ -2435,9 +2342,10 @@ class SystemTest extends System { */ stop(options) { - SystemTest.Stop(); this.started = false; + console.log('Stopped transient system: SystemTest'); + } /** @@ -2447,13 +2355,9 @@ class SystemTest extends System { */ static Start(options) { - if ('System' !== 'SystemTest') { - System.Start(); - } - SystemTest.Started = true; - console.log('Started SystemTest'); + console.log('Started system: SystemTest'); } @@ -2464,11 +2368,9 @@ class SystemTest extends System { */ static Stop(options) { - console.log('Stopped SystemTest'); + SystemTest.Started = false; - if ('System' !== 'SystemTest') { - System.Stop(); - } + console.log('Stopped system: SystemTest'); } diff --git a/package.json b/package.json index 147c216..bfff135 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "r3", - "version" : "2.0.146", + "version" : "2.0.158", "description": "", "private": true, "dependencies": { diff --git a/r3.php b/r3.php index a3424ba..e22a044 100755 --- a/r3.php +++ b/r3.php @@ -641,7 +641,7 @@ function generateUpdateFromInstanceOptions($file, $tokens) function generateEventListenersStart($file, $tokens) { - $token = 'CUSTOM_EVENT_LISTENERS'; + $token = 'CUSTOM_STATIC_EVENT_LISTENERS'; $store = getTokenStore($token, $tokens); @@ -651,7 +651,7 @@ function generateEventListenersStart($file, $tokens) echo "Will be building events for $file\n"; - $template = file_get_contents('src/templates/generated_event_listeners_start.template'); + $template = file_get_contents('src/templates/generated_static_event_listeners_start.template'); $updated = ''; @@ -671,12 +671,12 @@ function generateEventListenersStart($file, $tokens) $updated .= $updates; } - updateSection($file, 'GENERATED_EVENT_LISTENERS_START' , $updated); + updateSection($file, 'GENERATED_STATIC_EVENT_LISTENERS_START' , $updated); } function generateEventListenersStop($file, $tokens) { - $token = 'CUSTOM_EVENT_LISTENERS'; + $token = 'CUSTOM_STATIC_EVENT_LISTENERS'; $store = getTokenStore($token, $tokens); @@ -686,7 +686,7 @@ function generateEventListenersStop($file, $tokens) echo "Will be events for $file\n"; - $template = file_get_contents('src/templates/generated_event_listeners_stop.template'); + $template = file_get_contents('src/templates/generated_static_event_listeners_stop.template'); $updated = ''; @@ -698,7 +698,7 @@ function generateEventListenersStop($file, $tokens) $updated .= $updates; } - updateSection($file, 'GENERATED_EVENT_LISTENERS_STOP' , $updated); + updateSection($file, 'GENERATED_STATIC_EVENT_LISTENERS_STOP' , $updated); } /** @@ -951,7 +951,7 @@ function getEventListenerUpdates($template, $tokens, $token) function generateStaticEventListenerMethods($file, $tokens) { - $token = 'CUSTOM_EVENT_LISTENERS'; + $token = 'CUSTOM_STATIC_EVENT_LISTENERS'; $template = file_get_contents('src/templates/generated_static_methods.template'); @@ -1260,8 +1260,8 @@ function generateR3Dist($nodes) $contents = preg_replace('/\n^\s+\bCUSTOM_OPTIONS_START\b.*?\bCUSTOM_OPTIONS_END.*?$/sm', '', $contents); $contents = preg_replace('/\n^\s+\bCUSTOM_METHODS_START\b.*?\bCUSTOM_METHODS_END.*?$/sm', '', $contents); $contents = preg_replace('/\n^\s+\bCUSTOM_STATIC_METHODS_START\b.*?\bCUSTOM_STATIC_METHODS_END.*?$/sm', '', $contents); - $contents = preg_replace('/\n^\s+\bCUSTOM_EVENT_LISTENERS_START\b.*?\bCUSTOM_EVENT_LISTENERS_END.*?$/sm', '', $contents); -// $contents = preg_replace('/^\s+\bCUSTOM_EVENT_LISTENERS_START.*?$/sm', " Listens to the following Events:\n", $contents); + $contents = preg_replace('/\n^\s+\bCUSTOM_STATIC_EVENT_LISTENERS_START\b.*?\bCUSTOM_STATIC_EVENT_LISTENERS_END.*?$/sm', '', $contents); +// $contents = preg_replace('/^\s+\bCUSTOM_STATIC_EVENT_LISTENERS_START.*?$/sm', " Listens to the following Events:\n", $contents); $contents = preg_replace('/\n^\bmodule\.exports\s+=\s+{.*?}$/sm', '', $contents); $contents = preg_replace('/\n^\bmodule\.exports\s+=.*?$/sm', '', $contents); diff --git a/src/r3/r3-r3.js b/src/r3/r3-r3.js index 7e64334..5515791 100644 --- a/src/r3/r3-r3.js +++ b/src/r3/r3-r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.146'; - static compileDate = '2021 Sep 06 - 09:39:38 am'; + static version = '2.0.158'; + static compileDate = '2021 Sep 06 - 12:10:13 pm'; } //GENERATED_IMPORTS_START diff --git a/src/r3/r3-system/r3-system-input.js b/src/r3/r3-system/r3-system-input.js index 2f68a10..a860211 100644 --- a/src/r3/r3-system/r3-system-input.js +++ b/src/r3/r3-system/r3-system-input.js @@ -21,19 +21,11 @@ const System = require('./r3-system.js'); Inherited Methods: - - start() - Starts a transient system by registering subscriptions to events - - - stop() - Starts a transient by registering subscriptions to events + Inherited Static Methods: - - Start() - Starts the global system by registering subscriptions to events - - - Stop() - Stops the global system by removing these subscriptions to events + [Belonging to SystemInput] @@ -48,10 +40,10 @@ const System = require('./r3-system.js'); Methods: - start() - Just calls System.Start() + Starts a transient system by registering subscriptions to Events - stop() - Just calls System.Stop() + Stops a transient system to by removing subscriptions to Events Static Methods: @@ -70,6 +62,9 @@ const System = require('./r3-system.js'); CUSTOM_STATIC_OPTIONS_END CUSTOM_EVENT_LISTENERS_START + CUSTOM_EVENT_LISTENERS_END + + CUSTOM_STATIC_EVENT_LISTENERS_START Event.TOUCH_START Event.TOUCH_END Event.TOUCH_MOVE @@ -80,11 +75,11 @@ const System = require('./r3-system.js'); Event.MOUSE_UP Event.MOUSE_MOVE Event.MOUSE_WHEEL - CUSTOM_EVENT_LISTENERS_END + CUSTOM_STATIC_EVENT_LISTENERS_END CUSTOM_METHODS_START - start() - Just calls System.Start() - stop() - Just calls System.Stop() + 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 @@ -129,13 +124,22 @@ class SystemInput extends System { /** * start() - * - Just calls System.Start() + * - Starts a transient system by registering subscriptions to Events */ start() { //GENERATED_START_METHOD_START - SystemInput.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 @@ -145,13 +149,21 @@ class SystemInput extends System { /** * stop() - * - Just calls System.Stop() + * - Stops a transient system to by removing subscriptions to Events */ stop() { //GENERATED_STOP_METHOD_START - SystemInput.Stop(); + + //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 @@ -170,11 +182,7 @@ class SystemInput extends System { //GENERATED_STATIC_START_METHOD_START - if ('System' !== 'SystemInput') { - System.Start(); - } - - //GENERATED_EVENT_LISTENERS_START_START + //GENERATED_STATIC_EVENT_LISTENERS_START_START SystemInput.Subscriptions.push( new Event.Subscribe( Event.TOUCH_START, @@ -235,11 +243,14 @@ class SystemInput extends System { SystemInput.OnMouseWheel ) ); - //GENERATED_EVENT_LISTENERS_START_END + //GENERATED_STATIC_EVENT_LISTENERS_START_END + + //CUSTOM_BEFORE_STATIC_SYSTEM_START_START + //CUSTOM_BEFORE_STATIC_SYSTEM_START_END SystemInput.Started = true; - console.log('Started SystemInput'); + console.log('Started system: SystemInput'); //GENERATED_STATIC_START_METHOD_END @@ -256,7 +267,7 @@ class SystemInput extends System { //GENERATED_STATIC_STOP_METHOD_START - //GENERATED_EVENT_LISTENERS_STOP_START + //GENERATED_STATIC_EVENT_LISTENERS_STOP_START SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { @@ -357,13 +368,14 @@ class SystemInput extends System { }, [] ); - //GENERATED_EVENT_LISTENERS_STOP_END + //GENERATED_STATIC_EVENT_LISTENERS_STOP_END - console.log('Stopped SystemInput'); + //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_START + //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_END - if ('System' !== 'SystemInput') { - System.Stop(); - } + SystemInput.Started = false; + + console.log('Stopped system: SystemInput'); //GENERATED_STATIC_STOP_METHOD_END @@ -373,6 +385,9 @@ class SystemInput extends System { } //GENERATED_STATIC_METHODS_END + //GENERATED_EVENT_LISTENER_METHODS_START + //GENERATED_EVENT_LISTENER_METHODS_END + //GENERATED_STATIC_EVENT_LISTENER_METHODS_START /** diff --git a/src/r3/r3-system/r3-system-linking.js b/src/r3/r3-system/r3-system-linking.js index 210b393..7b3a91f 100644 --- a/src/r3/r3-system/r3-system-linking.js +++ b/src/r3/r3-system/r3-system-linking.js @@ -21,19 +21,11 @@ const System = require('./r3-system.js'); Inherited Methods: - - start() - Starts a transient system by registering subscriptions to events - - - stop() - Starts a transient by registering subscriptions to events + Inherited Static Methods: - - Start() - Starts the global system by registering subscriptions to events - - - Stop() - Stops the global system by removing these subscriptions to events + [Belonging to SystemLinking] @@ -70,9 +62,12 @@ const System = require('./r3-system.js'); CUSTOM_STATIC_OPTIONS_END CUSTOM_EVENT_LISTENERS_START + CUSTOM_EVENT_LISTENERS_END + + CUSTOM_STATIC_EVENT_LISTENERS_START Event.OBJECT_CREATED Event.INSTANCE_CREATED - CUSTOM_EVENT_LISTENERS_END + CUSTOM_STATIC_EVENT_LISTENERS_END CUSTOM_METHODS_START start(options) - Just calls System.Start(options) @@ -127,8 +122,16 @@ class SystemLinking extends System { start(options) { //GENERATED_START_METHOD_START - SystemLinking.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 @@ -144,8 +147,16 @@ class SystemLinking extends System { stop(options) { //GENERATED_STOP_METHOD_START - SystemLinking.Stop(); + + //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 @@ -165,11 +176,7 @@ class SystemLinking extends System { //GENERATED_STATIC_START_METHOD_START - if ('System' !== 'SystemLinking') { - System.Start(); - } - - //GENERATED_EVENT_LISTENERS_START_START + //GENERATED_STATIC_EVENT_LISTENERS_START_START SystemLinking.Subscriptions.push( new Event.Subscribe( Event.OBJECT_CREATED, @@ -182,11 +189,14 @@ class SystemLinking extends System { SystemLinking.OnInstanceCreated ) ); - //GENERATED_EVENT_LISTENERS_START_END + //GENERATED_STATIC_EVENT_LISTENERS_START_END + + //CUSTOM_BEFORE_STATIC_SYSTEM_START_START + //CUSTOM_BEFORE_STATIC_SYSTEM_START_END SystemLinking.Started = true; - console.log('Started SystemLinking'); + console.log('Started system: SystemLinking'); //GENERATED_STATIC_START_METHOD_END @@ -204,7 +214,7 @@ class SystemLinking extends System { //GENERATED_STATIC_STOP_METHOD_START - //GENERATED_EVENT_LISTENERS_STOP_START + //GENERATED_STATIC_EVENT_LISTENERS_STOP_START SystemLinking.Subscriptions = SystemLinking.Subscriptions.reduce( (result, subscription) => { @@ -225,13 +235,14 @@ class SystemLinking extends System { }, [] ); - //GENERATED_EVENT_LISTENERS_STOP_END + //GENERATED_STATIC_EVENT_LISTENERS_STOP_END - console.log('Stopped SystemLinking'); + //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_START + //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_END - if ('System' !== 'SystemLinking') { - System.Stop(); - } + SystemLinking.Started = false; + + console.log('Stopped system: SystemLinking'); //GENERATED_STATIC_STOP_METHOD_END @@ -241,6 +252,9 @@ class SystemLinking extends System { } //GENERATED_STATIC_METHODS_END + //GENERATED_EVENT_LISTENER_METHODS_START + //GENERATED_EVENT_LISTENER_METHODS_END + //GENERATED_STATIC_EVENT_LISTENER_METHODS_START /** diff --git a/src/r3/r3-system/r3-system-socket.js b/src/r3/r3-system/r3-system-socket.js index c2d37e1..cd4ba6d 100644 --- a/src/r3/r3-system/r3-system-socket.js +++ b/src/r3/r3-system/r3-system-socket.js @@ -21,19 +21,11 @@ const System = require('./r3-system.js'); Inherited Methods: - - start() - Starts a transient system by registering subscriptions to events - - - stop() - Starts a transient by registering subscriptions to events + Inherited Static Methods: - - Start() - Starts the global system by registering subscriptions to events - - - Stop() - Stops the global system by removing these subscriptions to events + [Belonging to SystemSocket] @@ -72,6 +64,9 @@ const System = require('./r3-system.js'); 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) @@ -125,8 +120,16 @@ class SystemSocket extends System { start(options) { //GENERATED_START_METHOD_START - SystemSocket.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 @@ -142,8 +145,16 @@ class SystemSocket extends System { stop(options) { //GENERATED_STOP_METHOD_START - SystemSocket.Stop(); + + //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 @@ -164,16 +175,15 @@ class SystemSocket extends System { //GENERATED_STATIC_START_METHOD_START - if ('System' !== 'SystemSocket') { - System.Start(); - } + //GENERATED_STATIC_EVENT_LISTENERS_START_START + //GENERATED_STATIC_EVENT_LISTENERS_START_END - //GENERATED_EVENT_LISTENERS_START_START - //GENERATED_EVENT_LISTENERS_START_END + //CUSTOM_BEFORE_STATIC_SYSTEM_START_START + //CUSTOM_BEFORE_STATIC_SYSTEM_START_END SystemSocket.Started = true; - console.log('Started SystemSocket'); + console.log('Started system: SystemSocket'); //GENERATED_STATIC_START_METHOD_END @@ -192,14 +202,15 @@ class SystemSocket extends System { //GENERATED_STATIC_STOP_METHOD_START - //GENERATED_EVENT_LISTENERS_STOP_START - //GENERATED_EVENT_LISTENERS_STOP_END + //GENERATED_STATIC_EVENT_LISTENERS_STOP_START + //GENERATED_STATIC_EVENT_LISTENERS_STOP_END - console.log('Stopped SystemSocket'); + //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_START + //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_END - if ('System' !== 'SystemSocket') { - System.Stop(); - } + SystemSocket.Started = false; + + console.log('Stopped system: SystemSocket'); //GENERATED_STATIC_STOP_METHOD_END @@ -209,6 +220,9 @@ class SystemSocket extends System { } //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 diff --git a/src/r3/r3-system/r3-system-test.js b/src/r3/r3-system/r3-system-test.js index 9b04676..2b32692 100644 --- a/src/r3/r3-system/r3-system-test.js +++ b/src/r3/r3-system/r3-system-test.js @@ -21,19 +21,11 @@ const System = require('./r3-system.js'); Inherited Methods: - - start() - Starts a transient system by registering subscriptions to events - - - stop() - Starts a transient by registering subscriptions to events + Inherited Static Methods: - - Start() - Starts the global system by registering subscriptions to events - - - Stop() - Stops the global system by removing these subscriptions to events + [Belonging to SystemTest] @@ -72,6 +64,9 @@ const System = require('./r3-system.js'); 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) @@ -125,8 +120,16 @@ class SystemTest extends System { start(options) { //GENERATED_START_METHOD_START - SystemTest.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 @@ -142,8 +145,16 @@ class SystemTest extends System { stop(options) { //GENERATED_STOP_METHOD_START - SystemTest.Stop(); + + //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 @@ -163,16 +174,15 @@ class SystemTest extends System { //GENERATED_STATIC_START_METHOD_START - if ('System' !== 'SystemTest') { - System.Start(); - } + //GENERATED_STATIC_EVENT_LISTENERS_START_START + //GENERATED_STATIC_EVENT_LISTENERS_START_END - //GENERATED_EVENT_LISTENERS_START_START - //GENERATED_EVENT_LISTENERS_START_END + //CUSTOM_BEFORE_STATIC_SYSTEM_START_START + //CUSTOM_BEFORE_STATIC_SYSTEM_START_END SystemTest.Started = true; - console.log('Started SystemTest'); + console.log('Started system: SystemTest'); //GENERATED_STATIC_START_METHOD_END @@ -190,14 +200,15 @@ class SystemTest extends System { //GENERATED_STATIC_STOP_METHOD_START - //GENERATED_EVENT_LISTENERS_STOP_START - //GENERATED_EVENT_LISTENERS_STOP_END + //GENERATED_STATIC_EVENT_LISTENERS_STOP_START + //GENERATED_STATIC_EVENT_LISTENERS_STOP_END - console.log('Stopped SystemTest'); + //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_START + //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_END - if ('System' !== 'SystemTest') { - System.Stop(); - } + SystemTest.Started = false; + + console.log('Stopped system: SystemTest'); //GENERATED_STATIC_STOP_METHOD_END @@ -207,6 +218,9 @@ class SystemTest extends System { } //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 diff --git a/src/r3/r3-system/r3-system.js b/src/r3/r3-system/r3-system.js index c89c1e1..3038aa8 100644 --- a/src/r3/r3-system/r3-system.js +++ b/src/r3/r3-system/r3-system.js @@ -13,14 +13,16 @@ const Utils = require('.././r3-utils'); 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() - Starts a transient by registering subscriptions to events CUSTOM_METHODS_END CUSTOM_STATIC_METHODS_START - Start() - Starts the global system by registering subscriptions to events - Stop() - Stops the global system by removing these subscriptions to events CUSTOM_STATIC_METHODS_END **/ @@ -61,93 +63,17 @@ class System { //GENERATED_CONSTRUCTOR_END //GENERATED_METHODS_START - - /** - * start() - * - Starts a transient system by registering subscriptions to events - */ - start() { - - //GENERATED_START_METHOD_START - System.Start(); - this.started = true; - //GENERATED_START_METHOD_END - - //CUSTOM_START_METHOD_START - //CUSTOM_START_METHOD_END - - } - - /** - * stop() - * - Starts a transient by registering subscriptions to events - */ - stop() { - - //GENERATED_STOP_METHOD_START - System.Stop(); - this.started = false; - //GENERATED_STOP_METHOD_END - - //CUSTOM_STOP_METHOD_START - //CUSTOM_STOP_METHOD_END - - } //GENERATED_METHODS_END //GENERATED_STATIC_METHODS_START - - /** - * Start() - * - Starts the global system by registering subscriptions to events - */ - static Start() { - - //GENERATED_STATIC_START_METHOD_START - - if ('System' !== 'System') { - System.Start(); - } - - //GENERATED_EVENT_LISTENERS_START_START - //GENERATED_EVENT_LISTENERS_START_END - - System.Started = true; - - console.log('Started System'); - - //GENERATED_STATIC_START_METHOD_END - - //CUSTOM_STATIC_START_METHOD_START - //CUSTOM_STATIC_START_METHOD_END - - } - - /** - * Stop() - * - Stops the global system by removing these subscriptions to events - */ - static Stop() { - - //GENERATED_STATIC_STOP_METHOD_START - - //GENERATED_EVENT_LISTENERS_STOP_START - //GENERATED_EVENT_LISTENERS_STOP_END - - console.log('Stopped System'); - - if ('System' !== 'System') { - System.Stop(); - } - - //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 diff --git a/src/templates/generated_event_listeners_start.template b/src/templates/generated_static_event_listeners_start.template similarity index 100% rename from src/templates/generated_event_listeners_start.template rename to src/templates/generated_static_event_listeners_start.template diff --git a/src/templates/generated_event_listeners_stop.template b/src/templates/generated_static_event_listeners_stop.template similarity index 100% rename from src/templates/generated_event_listeners_stop.template rename to src/templates/generated_static_event_listeners_stop.template diff --git a/src/templates/start.template b/src/templates/start.template index 9f45dab..fae4a85 100644 --- a/src/templates/start.template +++ b/src/templates/start.template @@ -1,2 +1,10 @@ - CLASS_NAME.Start(); - this.started = true; \ No newline at end of file + + //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: CLASS_NAME'); \ No newline at end of file diff --git a/src/templates/static_start.template b/src/templates/static_start.template index f9a9db6..9bb2a98 100644 --- a/src/templates/static_start.template +++ b/src/templates/static_start.template @@ -1,11 +1,10 @@ - if ('PARENT_SYSTEM' !== 'CLASS_NAME') { - PARENT_SYSTEM.Start(); - } + //GENERATED_STATIC_EVENT_LISTENERS_START_START + //GENERATED_STATIC_EVENT_LISTENERS_START_END - //GENERATED_EVENT_LISTENERS_START_START - //GENERATED_EVENT_LISTENERS_START_END + //CUSTOM_BEFORE_STATIC_SYSTEM_START_START + //CUSTOM_BEFORE_STATIC_SYSTEM_START_END CLASS_NAME.Started = true; - console.log('Started CLASS_NAME'); + console.log('Started system: CLASS_NAME'); diff --git a/src/templates/static_stop.template b/src/templates/static_stop.template index 3f276cd..1ddaf4a 100644 --- a/src/templates/static_stop.template +++ b/src/templates/static_stop.template @@ -1,9 +1,10 @@ - //GENERATED_EVENT_LISTENERS_STOP_START - //GENERATED_EVENT_LISTENERS_STOP_END + //GENERATED_STATIC_EVENT_LISTENERS_STOP_START + //GENERATED_STATIC_EVENT_LISTENERS_STOP_END - console.log('Stopped CLASS_NAME'); + //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_START + //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_END - if ('PARENT_SYSTEM' !== 'CLASS_NAME') { - PARENT_SYSTEM.Stop(); - } + CLASS_NAME.Started = false; + + console.log('Stopped system: CLASS_NAME'); diff --git a/src/templates/stop.template b/src/templates/stop.template index 0f434b5..775f503 100644 --- a/src/templates/stop.template +++ b/src/templates/stop.template @@ -1,2 +1,10 @@ - CLASS_NAME.Stop(); - this.started = false; \ No newline at end of file + + //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: CLASS_NAME'); \ No newline at end of file diff --git a/src/templates/system-base.template b/src/templates/system-base.template index 01ed82a..04e524d 100644 --- a/src/templates/system-base.template +++ b/src/templates/system-base.template @@ -9,6 +9,12 @@ const Utils = require('INCLUDE_PATH/r3-utils'); 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 CUSTOM_METHODS_END @@ -28,6 +34,12 @@ class CLASS_NAME { //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 diff --git a/src/templates/system.template b/src/templates/system.template index c4be3d2..235f0f1 100644 --- a/src/templates/system.template +++ b/src/templates/system.template @@ -17,14 +17,13 @@ const EXTEND_CLASS = require('./EXTEND_CLASS_FILE_NAME'); CUSTOM_EVENT_LISTENERS_START CUSTOM_EVENT_LISTENERS_END + CUSTOM_STATIC_EVENT_LISTENERS_START + CUSTOM_STATIC_EVENT_LISTENERS_END + CUSTOM_METHODS_START - start() - Just calls System.Start() - stop() - Just calls System.Stop() CUSTOM_METHODS_END CUSTOM_STATIC_METHODS_START - Start() - Starts the system by registering subscriptions to events - Stop() - Stops the system by removing these subscriptions to events CUSTOM_STATIC_METHODS_END **/ @@ -40,6 +39,9 @@ class CLASS_NAME extends EXTEND_CLASS { //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 diff --git a/src/templates/token.db b/src/templates/token.db index 9608664..9fb7069 100644 --- a/src/templates/token.db +++ b/src/templates/token.db @@ -8,6 +8,7 @@ GENERATED_DEFINES GENERATED_DISPOSE_INSTANCE_METHOD GENERATED_DISPOSE_METHOD GENERATED_EMIT_METHOD +GENERATED_EVENT_LISTENER_METHODS GENERATED_EVENT_LISTENERS_START GENERATED_EVENT_LISTENERS_STOP GENERATED_EVENTS @@ -23,6 +24,8 @@ GENERATED_START_METHOD GENERATED_STATIC_ASYNC_METHOD GENERATED_STATIC_EMIT_METHOD GENERATED_STATIC_EVENT_LISTENER_METHODS +GENERATED_STATIC_EVENT_LISTENERS_START +GENERATED_STATIC_EVENT_LISTENERS_STOP GENERATED_STATIC_METHOD_NAME_UPPERCASE_METHOD GENERATED_STATIC_METHODS GENERATED_STATIC_ON_INSTANCE_CREATED_METHOD @@ -48,6 +51,10 @@ GENERATED_UPDATE_INSTANCE_OPTIONS CUSTOM_AFTER_INIT CUSTOM_ASYNC_METHOD CUSTOM_BEFORE_INIT +CUSTOM_BEFORE_STATIC_SYSTEM_START +CUSTOM_BEFORE_STATIC_SYSTEM_STOP +CUSTOM_BEFORE_SYSTEM_START +CUSTOM_BEFORE_SYSTEM_STOP CUSTOM_CONVENIENT_DEFINES CUSTOM_CREATE_INSTANCE_METHOD CUSTOM_DISPOSE_INSTANCE_METHOD @@ -67,6 +74,7 @@ CUSTOM_OUT_OF_CLASS_IMPLEMENTATION CUSTOM_START_METHOD CUSTOM_STATIC_ASYNC_METHOD CUSTOM_STATIC_EMIT_METHOD +CUSTOM_STATIC_EVENT_LISTENERS CUSTOM_STATIC_METHOD_NAME_UPPERCASE_METHOD CUSTOM_STATIC_METHODS CUSTOM_STATIC_ON_INSTANCE_CREATED_METHOD diff --git a/version b/version index 944ec98..639f753 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.0.146 \ No newline at end of file +2.0.158 \ No newline at end of file