diff --git a/dist/r3.js b/dist/r3.js index a23d857..c814628 100644 --- a/dist/r3.js +++ b/dist/r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.158'; - static compileDate = '2021 Sep 06 - 12:10:13 pm'; + static version = '2.0.163'; + static compileDate = '2021 Sep 06 - 12:30:38 pm'; } /** @@ -282,11 +282,12 @@ Event.OBJECT_INITIALIZED = 0x10; Event.PAUSE = 0x11; Event.RESTART = 0x12; Event.START = 0x13; -Event.TOUCH_CANCEL = 0x14; -Event.TOUCH_END = 0x15; -Event.TOUCH_MOVE = 0x16; -Event.TOUCH_START = 0x17; -Event.MAX_EVENTS = 0x18; +Event.TEST_EVENT = 0x14; +Event.TOUCH_CANCEL = 0x15; +Event.TOUCH_END = 0x16; +Event.TOUCH_MOVE = 0x17; +Event.TOUCH_START = 0x18; +Event.MAX_EVENTS = 0x19; Event.GetEventName = function(eventId) { @@ -310,10 +311,11 @@ Event.GetEventName = function(eventId) { case 0x11 : return 'pause'; case 0x12 : return 'restart'; case 0x13 : return 'start'; - case 0x14 : return 'touch_cancel'; - case 0x15 : return 'touch_end'; - case 0x16 : return 'touch_move'; - case 0x17 : return 'touch_start'; + case 0x14 : return 'test_event'; + case 0x15 : return 'touch_cancel'; + case 0x16 : return 'touch_end'; + case 0x17 : return 'touch_move'; + case 0x18 : return 'touch_start'; default : throw new Error('Event type not defined : ' + eventId); } @@ -1617,6 +1619,8 @@ class Utils { - Stop() Stops the system by removing these subscriptions to events + Event.TEST_EVENT + **/ class SystemInput extends System { @@ -1643,6 +1647,13 @@ class SystemInput extends System { */ start() { + this.subscriptions.push( + new Event.Subscribe( + Event.TEST_EVENT, + this.OnTestEvent + ) + ); + console.log('Test for custom start before'); this.started = true; @@ -1657,6 +1668,16 @@ class SystemInput extends System { */ stop() { + this.subscriptions = this.subscriptions.reduce( + (result, subscription) => { + if (subscription.remove(Event.TEST_EVENT) !== true) { + result.push(subscription); + } + return result; + }, + [] + ); + this.started = false; console.log('Stopped transient system: SystemInput'); @@ -1675,54 +1696,63 @@ class SystemInput extends System { SystemInput.OnTouchStart ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.TOUCH_END, SystemInput.OnTouchEnd ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.TOUCH_MOVE, SystemInput.OnTouchMove ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.TOUCH_CANCEL, SystemInput.OnTouchCancel ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.KEYBOARD_DOWN, SystemInput.OnKeyboardDown ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.KEYBOARD_UP, SystemInput.OnKeyboardUp ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.MOUSE_DOWN, SystemInput.OnMouseDown ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.MOUSE_UP, SystemInput.OnMouseUp ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.MOUSE_MOVE, SystemInput.OnMouseMove ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.MOUSE_WHEEL, @@ -1744,7 +1774,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.TOUCH_START) !== true) { result.push(subscription); } return result; @@ -1754,7 +1784,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.TOUCH_END) !== true) { result.push(subscription); } return result; @@ -1764,7 +1794,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.TOUCH_MOVE) !== true) { result.push(subscription); } return result; @@ -1774,7 +1804,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.TOUCH_CANCEL) !== true) { result.push(subscription); } return result; @@ -1784,7 +1814,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.KEYBOARD_DOWN) !== true) { result.push(subscription); } return result; @@ -1794,7 +1824,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.KEYBOARD_UP) !== true) { result.push(subscription); } return result; @@ -1804,7 +1834,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.MOUSE_DOWN) !== true) { result.push(subscription); } return result; @@ -1814,7 +1844,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.MOUSE_UP) !== true) { result.push(subscription); } return result; @@ -1824,7 +1854,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.MOUSE_MOVE) !== true) { result.push(subscription); } return result; @@ -1834,7 +1864,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.MOUSE_WHEEL) !== true) { result.push(subscription); } return result; @@ -1848,6 +1878,16 @@ class SystemInput extends System { } + /** + * OnTestEvent() + * - Listens to events of type Event.TEST_EVENT and executes this function. + * @param data (The event data passed as argument - typically an R3Object) + * @return null + */ + OnTestEvent(data) { + + } + /** * OnTouchStart() * - Listens to events of type Event.TOUCH_START and executes this function. @@ -2058,6 +2098,7 @@ class SystemLinking extends System { SystemLinking.OnObjectCreated ) ); + SystemLinking.Subscriptions.push( new Event.Subscribe( Event.INSTANCE_CREATED, @@ -2080,7 +2121,7 @@ class SystemLinking extends System { SystemLinking.Subscriptions = SystemLinking.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.OBJECT_CREATED) !== true) { result.push(subscription); } return result; @@ -2090,7 +2131,7 @@ class SystemLinking extends System { SystemLinking.Subscriptions = SystemLinking.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.INSTANCE_CREATED) !== true) { result.push(subscription); } return result; diff --git a/package.json b/package.json index bfff135..f1de5b4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "r3", - "version" : "2.0.158", + "version" : "2.0.163", "description": "", "private": true, "dependencies": { diff --git a/r3.php b/r3.php index e22a044..ebe3e3e 100755 --- a/r3.php +++ b/r3.php @@ -640,6 +640,68 @@ function generateUpdateFromInstanceOptions($file, $tokens) } function generateEventListenersStart($file, $tokens) +{ + $token = 'CUSTOM_EVENT_LISTENERS'; + + $store = getTokenStore($token, $tokens); + + if (sizeof($store) <= 0) { + return; + } + + echo "Will be building events for $file\n"; + + $template = file_get_contents('src/templates/generated_event_listeners_start.template'); + + $updated = ''; + + foreach ($store as $item) { + + $item = trim($item); + + $eventName = preg_replace('/Event./', '', $item); + + $methodName = 'ON_'.$eventName; + + $methodName = to_camel_case_from_upper_underscore($methodName); + + $updates = str_replace('EVENT_NAME', $item, $template); + $updates = str_replace('CALL_BACK', $methodName, $updates); + + $updated .= $updates; + } + + updateSection($file, 'GENERATED_EVENT_LISTENERS_START' , $updated); +} + +function generateEventListenersStop($file, $tokens) +{ + $token = 'CUSTOM_EVENT_LISTENERS'; + + $store = getTokenStore($token, $tokens); + + if (sizeof($store) <= 0) { + return; + } + + echo "Will be events for $file\n"; + + $template = file_get_contents('src/templates/generated_event_listeners_stop.template'); + + $updated = ''; + + foreach ($store as $item) { + $item = trim($item); + + $updates = str_replace('EVENT_NAME', $item, $template); + + $updated .= $updates; + } + + updateSection($file, 'GENERATED_EVENT_LISTENERS_STOP' , $updated); +} + +function generateStaticEventListenersStart($file, $tokens) { $token = 'CUSTOM_STATIC_EVENT_LISTENERS'; @@ -674,7 +736,7 @@ function generateEventListenersStart($file, $tokens) updateSection($file, 'GENERATED_STATIC_EVENT_LISTENERS_START' , $updated); } -function generateEventListenersStop($file, $tokens) +function generateStaticEventListenersStop($file, $tokens) { $token = 'CUSTOM_STATIC_EVENT_LISTENERS'; @@ -856,55 +918,60 @@ function getEventListenerUpdates($template, $tokens, $token) foreach ($store as $item) { -// $detail = getMethodDetails($item); -// $argsArray = $detail['argsArray']; -// $args = $detail['args']; -// $methodTokenName = $detail['methodTokenName']; -// $methodName = $detail['methodName']; -// $comment = $detail['comment']; -// $returns = $detail['returns']; -// -// if (sizeof($argsArray) > 1) { -// $args = implode(",\n ", $argsArray); -// $args = "\n " . $args . "\n "; -// $params = implode("\n * @param ", $argsArray); -// $params = "\n * @param " . $params; -// } else if (sizeof($argsArray) === 1) { -// if ($args === '') { -// $params = $args; -// } else { -// $params = "\n * @param " . $args; -// } -// } -// -// if ($returns !== null) { -// $returns = "\n * @returns " . $returns; -// } -// -// $comment = wordwrap($comment, 110, "\n * "); -// -// $updated = $template; -// -// if ($token === 'CUSTOM_METHODS') { -// $potentialTemplate = strtolower('src/templates/' . $methodTokenName . '.template'); -// } else { -// $potentialTemplate = strtolower('src/templates/static_' . $methodTokenName . '.template'); -// } -// -// if (file_exists($potentialTemplate)) { -// $functionTemplate = file_get_contents($potentialTemplate); -// $updated = preg_replace('/^\s*FUNCTION_TEMPLATE/m', $functionTemplate, $updated); -// } else { -// $updated = preg_replace('/^.*?FUNCTION_TEMPLATE.*\n/m', '', $updated); -// } -// -// $updated = str_replace('METHOD_ARGS', $args, $updated); -// $updated = str_replace('METHOD_NAME_UPPERCASE', $methodTokenName, $updated); -// $updated = str_replace('METHOD_NAME', $methodName, $updated); -// $updated = str_replace('COMMENT', $comment, $updated); -// $updated = str_replace('PARAMS', $params, $updated); -// $updated = str_replace('RETURNS', $returns, $updated); + $item = trim($item); + $eventName = preg_replace('/Event./', '', $item); + + $methodName = 'ON_'.$eventName; + + $methodTokenName = $methodName; + + $methodName = to_camel_case_from_upper_underscore($methodName); + + $updated = $template; + + $methodArgs = 'data'; + + $params = "\n * @param " . $methodArgs . " (The event data passed as argument - typically an R3Object)"; + + $returns = "\n * @return null"; + + $potentialTemplate = strtolower('src/templates/' . $methodTokenName . '.template'); + + if (file_exists($potentialTemplate)) { + $functionTemplate = file_get_contents($potentialTemplate); + $updated = preg_replace('/^\s*FUNCTION_TEMPLATE/m', $functionTemplate, $updated); + } else { + $updated = preg_replace('/^.*?FUNCTION_TEMPLATE.*\n/m', '', $updated); + } + + $updated = str_replace('METHOD_NAME_UPPERCASE', $methodTokenName, $updated); + $updated = str_replace('METHOD_NAME', $methodName, $updated); + $updated = str_replace('METHOD_ARGS', $methodArgs, $updated); + + $comment = 'Listens to events of type ' . $item . ' and executes this function.'; + $comment = wordwrap($comment, 110, "\n * "); + + $updated = str_replace('COMMENT', $comment, $updated); + $updated = str_replace('PARAMS', $params, $updated); + $updated = str_replace('RETURNS', $returns, $updated); + + $updates .= $updated; + } + return $updates; +} + +function getStaticEventListenerUpdates($template, $tokens, $token) +{ + $store = getTokenStore($token, $tokens); + + if (sizeof($store) <= 0) { + return null; + } + + $updates = ''; + + foreach ($store as $item) { $item = trim($item); @@ -949,13 +1016,30 @@ function getEventListenerUpdates($template, $tokens, $token) return $updates; } +function generateEventListenerMethods($file, $tokens) +{ + $token = 'CUSTOM_EVENT_LISTENERS'; + + $template = file_get_contents('src/templates/generated_methods.template'); + + $updates = getEventListenerUpdates($template, $tokens, $token); + + if ($updates) { + echo "Updating event listeners.. \n"; + updateSection($file, 'GENERATED_EVENT_LISTENER_METHODS', $updates); + } else { + echo "No event listeners found to generate\n"; + } + +} + function generateStaticEventListenerMethods($file, $tokens) { $token = 'CUSTOM_STATIC_EVENT_LISTENERS'; $template = file_get_contents('src/templates/generated_static_methods.template'); - $updates = getEventListenerUpdates($template, $tokens, $token); + $updates = getStaticEventListenerUpdates($template, $tokens, $token); if ($updates) { echo "Updating static event listeners.. \n"; @@ -1465,6 +1549,8 @@ foreach ($files as $file) { generateStaticMethods($file, $tokens); + generateEventListenerMethods($file, $tokens); + generateStaticEventListenerMethods($file, $tokens); generateInitOptions($file, $tokens); @@ -1481,6 +1567,10 @@ foreach ($files as $file) { generateEventListenersStop($file, $tokens); + generateStaticEventListenersStart($file, $tokens); + + generateStaticEventListenersStop($file, $tokens); + /** * Try to restore the rest of the old data because now methods were generated. * If not all data restores now - a method name / token has changed and we need diff --git a/src/r3/r3-event.js b/src/r3/r3-event.js index 6aeda24..ad85c81 100644 --- a/src/r3/r3-event.js +++ b/src/r3/r3-event.js @@ -323,11 +323,12 @@ Event.OBJECT_INITIALIZED = 0x10; Event.PAUSE = 0x11; Event.RESTART = 0x12; Event.START = 0x13; -Event.TOUCH_CANCEL = 0x14; -Event.TOUCH_END = 0x15; -Event.TOUCH_MOVE = 0x16; -Event.TOUCH_START = 0x17; -Event.MAX_EVENTS = 0x18; +Event.TEST_EVENT = 0x14; +Event.TOUCH_CANCEL = 0x15; +Event.TOUCH_END = 0x16; +Event.TOUCH_MOVE = 0x17; +Event.TOUCH_START = 0x18; +Event.MAX_EVENTS = 0x19; Event.GetEventName = function(eventId) { @@ -351,10 +352,11 @@ Event.GetEventName = function(eventId) { case 0x11 : return 'pause'; case 0x12 : return 'restart'; case 0x13 : return 'start'; - case 0x14 : return 'touch_cancel'; - case 0x15 : return 'touch_end'; - case 0x16 : return 'touch_move'; - case 0x17 : return 'touch_start'; + case 0x14 : return 'test_event'; + case 0x15 : return 'touch_cancel'; + case 0x16 : return 'touch_end'; + case 0x17 : return 'touch_move'; + case 0x18 : return 'touch_start'; default : throw new Error('Event type not defined : ' + eventId); } diff --git a/src/r3/r3-r3.js b/src/r3/r3-r3.js index 5515791..917b0f4 100644 --- a/src/r3/r3-r3.js +++ b/src/r3/r3-r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.158'; - static compileDate = '2021 Sep 06 - 12:10:13 pm'; + static version = '2.0.163'; + static compileDate = '2021 Sep 06 - 12:30:38 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 a860211..bdfe811 100644 --- a/src/r3/r3-system/r3-system-input.js +++ b/src/r3/r3-system/r3-system-input.js @@ -131,6 +131,13 @@ class SystemInput extends System { //GENERATED_START_METHOD_START //GENERATED_EVENT_LISTENERS_START_START + + this.subscriptions.push( + new Event.Subscribe( + Event.TEST_EVENT, + this.OnTestEvent + ) + ); //GENERATED_EVENT_LISTENERS_START_END //CUSTOM_BEFORE_SYSTEM_START_START @@ -156,6 +163,15 @@ class SystemInput extends System { //GENERATED_STOP_METHOD_START //GENERATED_EVENT_LISTENERS_STOP_START + this.subscriptions = this.subscriptions.reduce( + (result, subscription) => { + if (subscription.remove(Event.TEST_EVENT) !== true) { + result.push(subscription); + } + return result; + }, + [] + ); //GENERATED_EVENT_LISTENERS_STOP_END //CUSTOM_BEFORE_SYSTEM_STOP_START @@ -183,60 +199,70 @@ class SystemInput extends System { //GENERATED_STATIC_START_METHOD_START //GENERATED_STATIC_EVENT_LISTENERS_START_START + SystemInput.Subscriptions.push( new Event.Subscribe( Event.TOUCH_START, SystemInput.OnTouchStart ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.TOUCH_END, SystemInput.OnTouchEnd ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.TOUCH_MOVE, SystemInput.OnTouchMove ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.TOUCH_CANCEL, SystemInput.OnTouchCancel ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.KEYBOARD_DOWN, SystemInput.OnKeyboardDown ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.KEYBOARD_UP, SystemInput.OnKeyboardUp ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.MOUSE_DOWN, SystemInput.OnMouseDown ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.MOUSE_UP, SystemInput.OnMouseUp ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.MOUSE_MOVE, SystemInput.OnMouseMove ) ); + SystemInput.Subscriptions.push( new Event.Subscribe( Event.MOUSE_WHEEL, @@ -271,7 +297,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.TOUCH_START) !== true) { result.push(subscription); } return result; @@ -281,7 +307,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.TOUCH_END) !== true) { result.push(subscription); } return result; @@ -291,7 +317,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.TOUCH_MOVE) !== true) { result.push(subscription); } return result; @@ -301,7 +327,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.TOUCH_CANCEL) !== true) { result.push(subscription); } return result; @@ -311,7 +337,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.KEYBOARD_DOWN) !== true) { result.push(subscription); } return result; @@ -321,7 +347,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.KEYBOARD_UP) !== true) { result.push(subscription); } return result; @@ -331,7 +357,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.MOUSE_DOWN) !== true) { result.push(subscription); } return result; @@ -341,7 +367,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.MOUSE_UP) !== true) { result.push(subscription); } return result; @@ -351,7 +377,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.MOUSE_MOVE) !== true) { result.push(subscription); } return result; @@ -361,7 +387,7 @@ class SystemInput extends System { SystemInput.Subscriptions = SystemInput.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.MOUSE_WHEEL) !== true) { result.push(subscription); } return result; @@ -386,6 +412,22 @@ class SystemInput extends System { //GENERATED_STATIC_METHODS_END //GENERATED_EVENT_LISTENER_METHODS_START + + /** + * OnTestEvent() + * - Listens to events of type Event.TEST_EVENT and executes this function. + * @param data (The event data passed as argument - typically an R3Object) + * @return null + */ + OnTestEvent(data) { + + //GENERATED_ON_TEST_EVENT_METHOD_START + //GENERATED_ON_TEST_EVENT_METHOD_END + + //CUSTOM_ON_TEST_EVENT_METHOD_START + //CUSTOM_ON_TEST_EVENT_METHOD_END + + } //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 7b3a91f..0b0926d 100644 --- a/src/r3/r3-system/r3-system-linking.js +++ b/src/r3/r3-system/r3-system-linking.js @@ -177,12 +177,14 @@ class SystemLinking extends System { //GENERATED_STATIC_START_METHOD_START //GENERATED_STATIC_EVENT_LISTENERS_START_START + SystemLinking.Subscriptions.push( new Event.Subscribe( Event.OBJECT_CREATED, SystemLinking.OnObjectCreated ) ); + SystemLinking.Subscriptions.push( new Event.Subscribe( Event.INSTANCE_CREATED, @@ -218,7 +220,7 @@ class SystemLinking extends System { SystemLinking.Subscriptions = SystemLinking.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.OBJECT_CREATED) !== true) { result.push(subscription); } return result; @@ -228,7 +230,7 @@ class SystemLinking extends System { SystemLinking.Subscriptions = SystemLinking.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(Event.INSTANCE_CREATED) !== true) { result.push(subscription); } return result; diff --git a/src/templates/generated_event_listeners_start.template b/src/templates/generated_event_listeners_start.template new file mode 100644 index 0000000..2df0e47 --- /dev/null +++ b/src/templates/generated_event_listeners_start.template @@ -0,0 +1,7 @@ + + this.subscriptions.push( + new Event.Subscribe( + EVENT_NAME, + this.CALL_BACK + ) + ); diff --git a/src/templates/generated_event_listeners_stop.template b/src/templates/generated_event_listeners_stop.template new file mode 100644 index 0000000..4eaa969 --- /dev/null +++ b/src/templates/generated_event_listeners_stop.template @@ -0,0 +1,9 @@ + this.subscriptions = this.subscriptions.reduce( + (result, subscription) => { + if (subscription.remove(EVENT_NAME) !== true) { + result.push(subscription); + } + return result; + }, + [] + ); diff --git a/src/templates/generated_static_event_listeners_start.template b/src/templates/generated_static_event_listeners_start.template index b7969be..f0b5ed3 100644 --- a/src/templates/generated_static_event_listeners_start.template +++ b/src/templates/generated_static_event_listeners_start.template @@ -1,3 +1,4 @@ + SYSTEM_NAME.Subscriptions.push( new Event.Subscribe( EVENT_NAME, diff --git a/src/templates/generated_static_event_listeners_stop.template b/src/templates/generated_static_event_listeners_stop.template index c7e9b28..d39a119 100644 --- a/src/templates/generated_static_event_listeners_stop.template +++ b/src/templates/generated_static_event_listeners_stop.template @@ -1,7 +1,7 @@ SYSTEM_NAME.Subscriptions = SYSTEM_NAME.Subscriptions.reduce( (result, subscription) => { - if (subscription.remove() !== true) { + if (subscription.remove(EVENT_NAME) !== true) { result.push(subscription); } return result; diff --git a/src/templates/token.db b/src/templates/token.db index 9fb7069..ce5482d 100644 --- a/src/templates/token.db +++ b/src/templates/token.db @@ -19,6 +19,7 @@ GENERATED_INDEX_BODY GENERATED_INHERITED GENERATED_METHOD_NAME_UPPERCASE_METHOD GENERATED_METHODS +GENERATED_ON_TEST_EVENT_METHOD GENERATED_OPTIONS_INIT GENERATED_START_METHOD GENERATED_STATIC_ASYNC_METHOD @@ -68,6 +69,7 @@ CUSTOM_INSTANCE_OPTIONS_MAPPING CUSTOM_LINKED_OBJECTS CUSTOM_METHOD_NAME_UPPERCASE_METHOD CUSTOM_METHODS +CUSTOM_ON_TEST_EVENT_METHOD CUSTOM_OPTIONS CUSTOM_OPTIONS_INIT CUSTOM_OUT_OF_CLASS_IMPLEMENTATION diff --git a/version b/version index 639f753..5166a2f 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.0.158 \ No newline at end of file +2.0.163 \ No newline at end of file