input system

master
Theunis J. Botha 2021-09-07 06:01:07 +02:00
parent b745fa0690
commit 8d3554b46b
17 changed files with 201 additions and 486 deletions

306
dist/r3.js vendored
View File

@ -1,12 +1,12 @@
class R3 {
static version = '2.0.163';
static compileDate = '2021 Sep 06 - 12:30:38 pm';
static version = '2.0.176';
static compileDate = '2021 Sep 06 - 13:04:25 pm';
}
/**
Started=false
Subscriptions=[]
Subscriptions={}
**/
@ -24,7 +24,7 @@ class System {
options.started = false;
}
if (typeof options.subscriptions === 'undefined') {
options.subscriptions = [];
options.subscriptions = {};
}
Object.assign(this, options);
@ -36,7 +36,7 @@ class System {
}
System.Started = false;
System.Subscriptions = [];
System.Subscriptions = {};
class Event {
@ -226,6 +226,7 @@ class Event {
}
Event.Subscriptions[eventId][subscriptionId] = callback;
} else {
Event.Subscriptions[eventId] = {};
Event.Subscriptions[eventId][subscriptionId] = callback;
@ -253,6 +254,8 @@ class Event {
if (listeners.length === 0) {
delete Event.Subscriptions[eventId];
}
return true;
}
}(eventId, subscriptionId),
@ -282,12 +285,11 @@ Event.OBJECT_INITIALIZED = 0x10;
Event.PAUSE = 0x11;
Event.RESTART = 0x12;
Event.START = 0x13;
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.TOUCH_CANCEL = 0x14;
Event.TOUCH_END = 0x15;
Event.TOUCH_MOVE = 0x16;
Event.TOUCH_START = 0x17;
Event.MAX_EVENTS = 0x18;
Event.GetEventName = function(eventId) {
@ -311,11 +313,10 @@ Event.GetEventName = function(eventId) {
case 0x11 : return 'pause';
case 0x12 : return 'restart';
case 0x13 : return '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';
case 0x14 : return 'touch_cancel';
case 0x15 : return 'touch_end';
case 0x16 : return 'touch_move';
case 0x17 : return 'touch_start';
default :
throw new Error('Event type not defined : ' + eventId);
}
@ -1578,12 +1579,12 @@ class Utils {
Inherited Properties:
- started (Default value false)
- subscriptions (Default value [])
- subscriptions (Default value {})
Inherited Static Properties:
- Started (Default value false)
- Subscriptions (Default value [])
- Subscriptions (Default value {})
Inherited Methods:
@ -1619,8 +1620,6 @@ class Utils {
- Stop()
Stops the system by removing these subscriptions to events
Event.TEST_EVENT
**/
class SystemInput extends System {
@ -1647,13 +1646,6 @@ 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;
@ -1668,16 +1660,6 @@ 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');
@ -1690,74 +1672,54 @@ class SystemInput extends System {
*/
static Start() {
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.TOUCH_START,
SystemInput.OnTouchStart
)
SystemInput.Subscriptions['TOUCH_START'] = new Event.Subscribe(
Event.TOUCH_START,
SystemInput.OnTouchStart
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.TOUCH_END,
SystemInput.OnTouchEnd
)
SystemInput.Subscriptions['TOUCH_END'] = new Event.Subscribe(
Event.TOUCH_END,
SystemInput.OnTouchEnd
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.TOUCH_MOVE,
SystemInput.OnTouchMove
)
SystemInput.Subscriptions['TOUCH_MOVE'] = new Event.Subscribe(
Event.TOUCH_MOVE,
SystemInput.OnTouchMove
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.TOUCH_CANCEL,
SystemInput.OnTouchCancel
)
SystemInput.Subscriptions['TOUCH_CANCEL'] = new Event.Subscribe(
Event.TOUCH_CANCEL,
SystemInput.OnTouchCancel
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.KEYBOARD_DOWN,
SystemInput.OnKeyboardDown
)
SystemInput.Subscriptions['KEYBOARD_DOWN'] = new Event.Subscribe(
Event.KEYBOARD_DOWN,
SystemInput.OnKeyboardDown
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.KEYBOARD_UP,
SystemInput.OnKeyboardUp
)
SystemInput.Subscriptions['KEYBOARD_UP'] = new Event.Subscribe(
Event.KEYBOARD_UP,
SystemInput.OnKeyboardUp
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.MOUSE_DOWN,
SystemInput.OnMouseDown
)
SystemInput.Subscriptions['MOUSE_DOWN'] = new Event.Subscribe(
Event.MOUSE_DOWN,
SystemInput.OnMouseDown
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.MOUSE_UP,
SystemInput.OnMouseUp
)
SystemInput.Subscriptions['MOUSE_UP'] = new Event.Subscribe(
Event.MOUSE_UP,
SystemInput.OnMouseUp
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.MOUSE_MOVE,
SystemInput.OnMouseMove
)
SystemInput.Subscriptions['MOUSE_MOVE'] = new Event.Subscribe(
Event.MOUSE_MOVE,
SystemInput.OnMouseMove
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.MOUSE_WHEEL,
SystemInput.OnMouseWheel
)
SystemInput.Subscriptions['MOUSE_WHEEL'] = new Event.Subscribe(
Event.MOUSE_WHEEL,
SystemInput.OnMouseWheel
);
SystemInput.Started = true;
@ -1772,105 +1734,35 @@ class SystemInput extends System {
*/
static Stop() {
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.TOUCH_START) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['TOUCH_START'].remove();
delete SystemInput.Subscriptions['TOUCH_START'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.TOUCH_END) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['TOUCH_END'].remove();
delete SystemInput.Subscriptions['TOUCH_END'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.TOUCH_MOVE) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['TOUCH_MOVE'].remove();
delete SystemInput.Subscriptions['TOUCH_MOVE'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.TOUCH_CANCEL) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['TOUCH_CANCEL'].remove();
delete SystemInput.Subscriptions['TOUCH_CANCEL'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.KEYBOARD_DOWN) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['KEYBOARD_DOWN'].remove();
delete SystemInput.Subscriptions['KEYBOARD_DOWN'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.KEYBOARD_UP) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['KEYBOARD_UP'].remove();
delete SystemInput.Subscriptions['KEYBOARD_UP'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.MOUSE_DOWN) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['MOUSE_DOWN'].remove();
delete SystemInput.Subscriptions['MOUSE_DOWN'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.MOUSE_UP) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['MOUSE_UP'].remove();
delete SystemInput.Subscriptions['MOUSE_UP'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.MOUSE_MOVE) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['MOUSE_MOVE'].remove();
delete SystemInput.Subscriptions['MOUSE_MOVE'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.MOUSE_WHEEL) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['MOUSE_WHEEL'].remove();
delete SystemInput.Subscriptions['MOUSE_WHEEL'];
SystemInput.Started = false;
@ -1878,16 +1770,6 @@ 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.
@ -1998,12 +1880,12 @@ class SystemInput extends System {
Inherited Properties:
- started (Default value false)
- subscriptions (Default value [])
- subscriptions (Default value {})
Inherited Static Properties:
- Started (Default value false)
- Subscriptions (Default value [])
- Subscriptions (Default value {})
Inherited Methods:
@ -2092,18 +1974,14 @@ class SystemLinking extends System {
*/
static Start(options) {
SystemLinking.Subscriptions.push(
new Event.Subscribe(
Event.OBJECT_CREATED,
SystemLinking.OnObjectCreated
)
SystemLinking.Subscriptions['OBJECT_CREATED'] = new Event.Subscribe(
Event.OBJECT_CREATED,
SystemLinking.OnObjectCreated
);
SystemLinking.Subscriptions.push(
new Event.Subscribe(
Event.INSTANCE_CREATED,
SystemLinking.OnInstanceCreated
)
SystemLinking.Subscriptions['INSTANCE_CREATED'] = new Event.Subscribe(
Event.INSTANCE_CREATED,
SystemLinking.OnInstanceCreated
);
SystemLinking.Started = true;
@ -2119,25 +1997,11 @@ class SystemLinking extends System {
*/
static Stop(options) {
SystemLinking.Subscriptions = SystemLinking.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.OBJECT_CREATED) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemLinking.Subscriptions['OBJECT_CREATED'].remove();
delete SystemLinking.Subscriptions['OBJECT_CREATED'];
SystemLinking.Subscriptions = SystemLinking.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.INSTANCE_CREATED) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemLinking.Subscriptions['INSTANCE_CREATED'].remove();
delete SystemLinking.Subscriptions['INSTANCE_CREATED'];
SystemLinking.Started = false;
@ -2175,12 +2039,12 @@ class SystemLinking extends System {
Inherited Properties:
- started (Default value false)
- subscriptions (Default value [])
- subscriptions (Default value {})
Inherited Static Properties:
- Started (Default value false)
- Subscriptions (Default value [])
- Subscriptions (Default value {})
Inherited Methods:
@ -2302,12 +2166,12 @@ class SystemSocket extends System {
Inherited Properties:
- started (Default value false)
- subscriptions (Default value [])
- subscriptions (Default value {})
Inherited Static Properties:
- Started (Default value false)
- Subscriptions (Default value [])
- Subscriptions (Default value {})
Inherited Methods:

View File

@ -1,6 +1,6 @@
{
"name": "r3",
"version" : "2.0.163",
"version" : "2.0.176",
"description": "",
"private": true,
"dependencies": {

14
r3.php
View File

@ -665,7 +665,8 @@ function generateEventListenersStart($file, $tokens)
$methodName = to_camel_case_from_upper_underscore($methodName);
$updates = str_replace('EVENT_NAME', $item, $template);
$updates = str_replace('FULL_EVENT_NAME', $item, $template);
$updates = str_replace('EVENT_NAME', $eventName, $updates);
$updates = str_replace('CALL_BACK', $methodName, $updates);
$updated .= $updates;
@ -693,7 +694,9 @@ function generateEventListenersStop($file, $tokens)
foreach ($store as $item) {
$item = trim($item);
$updates = str_replace('EVENT_NAME', $item, $template);
$eventName = preg_replace('/Event./', '', $item);
$updates = str_replace('EVENT_NAME', $eventName, $template);
$updated .= $updates;
}
@ -727,7 +730,8 @@ function generateStaticEventListenersStart($file, $tokens)
$methodName = to_camel_case_from_upper_underscore($methodName);
$updates = str_replace('EVENT_NAME', $item, $template);
$updates = str_replace('FULL_EVENT_NAME', $item, $template);
$updates = str_replace('EVENT_NAME', $eventName, $updates);
$updates = str_replace('CALL_BACK', $methodName, $updates);
$updated .= $updates;
@ -755,7 +759,9 @@ function generateStaticEventListenersStop($file, $tokens)
foreach ($store as $item) {
$item = trim($item);
$updates = str_replace('EVENT_NAME', $item, $template);
$eventName = preg_replace('/Event./', '', $item);
$updates = str_replace('EVENT_NAME', $eventName, $template);
$updated .= $updates;
}

View File

@ -262,6 +262,7 @@ class Event {
}
Event.Subscriptions[eventId][subscriptionId] = callback;
} else {
Event.Subscriptions[eventId] = {};
Event.Subscriptions[eventId][subscriptionId] = callback;
@ -289,6 +290,8 @@ class Event {
if (listeners.length === 0) {
delete Event.Subscriptions[eventId];
}
return true;
}
}(eventId, subscriptionId),
@ -323,12 +326,11 @@ Event.OBJECT_INITIALIZED = 0x10;
Event.PAUSE = 0x11;
Event.RESTART = 0x12;
Event.START = 0x13;
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.TOUCH_CANCEL = 0x14;
Event.TOUCH_END = 0x15;
Event.TOUCH_MOVE = 0x16;
Event.TOUCH_START = 0x17;
Event.MAX_EVENTS = 0x18;
Event.GetEventName = function(eventId) {
@ -352,11 +354,10 @@ Event.GetEventName = function(eventId) {
case 0x11 : return 'pause';
case 0x12 : return 'restart';
case 0x13 : return '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';
case 0x14 : return 'touch_cancel';
case 0x15 : return 'touch_end';
case 0x16 : return 'touch_move';
case 0x17 : return 'touch_start';
default :
throw new Error('Event type not defined : ' + eventId);
}

View File

@ -1,6 +1,6 @@
class R3 {
static version = '2.0.163';
static compileDate = '2021 Sep 06 - 12:30:38 pm';
static version = '2.0.176';
static compileDate = '2021 Sep 06 - 13:04:25 pm';
}
//GENERATED_IMPORTS_START

View File

@ -12,12 +12,12 @@ const System = require('./r3-system.js');
Inherited Properties:
- started (Default value false)
- subscriptions (Default value [])
- subscriptions (Default value {})
Inherited Static Properties:
- Started (Default value false)
- Subscriptions (Default value [])
- Subscriptions (Default value {})
Inherited Methods:
@ -131,13 +131,6 @@ 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
@ -163,15 +156,6 @@ 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
@ -199,76 +183,56 @@ 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['TOUCH_START'] = new Event.Subscribe(
Event.TOUCH_START,
SystemInput.OnTouchStart
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.TOUCH_END,
SystemInput.OnTouchEnd
)
SystemInput.Subscriptions['TOUCH_END'] = new Event.Subscribe(
Event.TOUCH_END,
SystemInput.OnTouchEnd
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.TOUCH_MOVE,
SystemInput.OnTouchMove
)
SystemInput.Subscriptions['TOUCH_MOVE'] = new Event.Subscribe(
Event.TOUCH_MOVE,
SystemInput.OnTouchMove
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.TOUCH_CANCEL,
SystemInput.OnTouchCancel
)
SystemInput.Subscriptions['TOUCH_CANCEL'] = new Event.Subscribe(
Event.TOUCH_CANCEL,
SystemInput.OnTouchCancel
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.KEYBOARD_DOWN,
SystemInput.OnKeyboardDown
)
SystemInput.Subscriptions['KEYBOARD_DOWN'] = new Event.Subscribe(
Event.KEYBOARD_DOWN,
SystemInput.OnKeyboardDown
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.KEYBOARD_UP,
SystemInput.OnKeyboardUp
)
SystemInput.Subscriptions['KEYBOARD_UP'] = new Event.Subscribe(
Event.KEYBOARD_UP,
SystemInput.OnKeyboardUp
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.MOUSE_DOWN,
SystemInput.OnMouseDown
)
SystemInput.Subscriptions['MOUSE_DOWN'] = new Event.Subscribe(
Event.MOUSE_DOWN,
SystemInput.OnMouseDown
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.MOUSE_UP,
SystemInput.OnMouseUp
)
SystemInput.Subscriptions['MOUSE_UP'] = new Event.Subscribe(
Event.MOUSE_UP,
SystemInput.OnMouseUp
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.MOUSE_MOVE,
SystemInput.OnMouseMove
)
SystemInput.Subscriptions['MOUSE_MOVE'] = new Event.Subscribe(
Event.MOUSE_MOVE,
SystemInput.OnMouseMove
);
SystemInput.Subscriptions.push(
new Event.Subscribe(
Event.MOUSE_WHEEL,
SystemInput.OnMouseWheel
)
SystemInput.Subscriptions['MOUSE_WHEEL'] = new Event.Subscribe(
Event.MOUSE_WHEEL,
SystemInput.OnMouseWheel
);
//GENERATED_STATIC_EVENT_LISTENERS_START_END
//CUSTOM_BEFORE_STATIC_SYSTEM_START_START
@ -294,106 +258,36 @@ class SystemInput extends System {
//GENERATED_STATIC_STOP_METHOD_START
//GENERATED_STATIC_EVENT_LISTENERS_STOP_START
SystemInput.Subscriptions['TOUCH_START'].remove();
delete SystemInput.Subscriptions['TOUCH_START'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.TOUCH_START) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['TOUCH_END'].remove();
delete SystemInput.Subscriptions['TOUCH_END'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.TOUCH_END) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['TOUCH_MOVE'].remove();
delete SystemInput.Subscriptions['TOUCH_MOVE'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.TOUCH_MOVE) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['TOUCH_CANCEL'].remove();
delete SystemInput.Subscriptions['TOUCH_CANCEL'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.TOUCH_CANCEL) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['KEYBOARD_DOWN'].remove();
delete SystemInput.Subscriptions['KEYBOARD_DOWN'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.KEYBOARD_DOWN) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['KEYBOARD_UP'].remove();
delete SystemInput.Subscriptions['KEYBOARD_UP'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.KEYBOARD_UP) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['MOUSE_DOWN'].remove();
delete SystemInput.Subscriptions['MOUSE_DOWN'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.MOUSE_DOWN) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['MOUSE_UP'].remove();
delete SystemInput.Subscriptions['MOUSE_UP'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.MOUSE_UP) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['MOUSE_MOVE'].remove();
delete SystemInput.Subscriptions['MOUSE_MOVE'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.MOUSE_MOVE) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemInput.Subscriptions['MOUSE_WHEEL'].remove();
delete SystemInput.Subscriptions['MOUSE_WHEEL'];
SystemInput.Subscriptions = SystemInput.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.MOUSE_WHEEL) !== true) {
result.push(subscription);
}
return result;
},
[]
);
//GENERATED_STATIC_EVENT_LISTENERS_STOP_END
//CUSTOM_BEFORE_STATIC_SYSTEM_STOP_START
@ -412,22 +306,6 @@ 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

View File

@ -12,12 +12,12 @@ const System = require('./r3-system.js');
Inherited Properties:
- started (Default value false)
- subscriptions (Default value [])
- subscriptions (Default value {})
Inherited Static Properties:
- Started (Default value false)
- Subscriptions (Default value [])
- Subscriptions (Default value {})
Inherited Methods:
@ -177,20 +177,16 @@ 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['OBJECT_CREATED'] = new Event.Subscribe(
Event.OBJECT_CREATED,
SystemLinking.OnObjectCreated
);
SystemLinking.Subscriptions.push(
new Event.Subscribe(
Event.INSTANCE_CREATED,
SystemLinking.OnInstanceCreated
)
SystemLinking.Subscriptions['INSTANCE_CREATED'] = new Event.Subscribe(
Event.INSTANCE_CREATED,
SystemLinking.OnInstanceCreated
);
//GENERATED_STATIC_EVENT_LISTENERS_START_END
//CUSTOM_BEFORE_STATIC_SYSTEM_START_START
@ -217,26 +213,12 @@ class SystemLinking extends System {
//GENERATED_STATIC_STOP_METHOD_START
//GENERATED_STATIC_EVENT_LISTENERS_STOP_START
SystemLinking.Subscriptions['OBJECT_CREATED'].remove();
delete SystemLinking.Subscriptions['OBJECT_CREATED'];
SystemLinking.Subscriptions = SystemLinking.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.OBJECT_CREATED) !== true) {
result.push(subscription);
}
return result;
},
[]
);
SystemLinking.Subscriptions['INSTANCE_CREATED'].remove();
delete SystemLinking.Subscriptions['INSTANCE_CREATED'];
SystemLinking.Subscriptions = SystemLinking.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(Event.INSTANCE_CREATED) !== true) {
result.push(subscription);
}
return result;
},
[]
);
//GENERATED_STATIC_EVENT_LISTENERS_STOP_END
//CUSTOM_BEFORE_STATIC_SYSTEM_STOP_START

View File

@ -12,12 +12,12 @@ const System = require('./r3-system.js');
Inherited Properties:
- started (Default value false)
- subscriptions (Default value [])
- subscriptions (Default value {})
Inherited Static Properties:
- Started (Default value false)
- Subscriptions (Default value [])
- Subscriptions (Default value {})
Inherited Methods:
@ -176,6 +176,7 @@ class SystemSocket extends System {
//GENERATED_STATIC_START_METHOD_START
//GENERATED_STATIC_EVENT_LISTENERS_START_START
//GENERATED_STATIC_EVENT_LISTENERS_START_END
//CUSTOM_BEFORE_STATIC_SYSTEM_START_START

View File

@ -12,12 +12,12 @@ const System = require('./r3-system.js');
Inherited Properties:
- started (Default value false)
- subscriptions (Default value [])
- subscriptions (Default value {})
Inherited Static Properties:
- Started (Default value false)
- Subscriptions (Default value [])
- Subscriptions (Default value {})
Inherited Methods:
@ -175,6 +175,7 @@ class SystemTest extends System {
//GENERATED_STATIC_START_METHOD_START
//GENERATED_STATIC_EVENT_LISTENERS_START_START
//GENERATED_STATIC_EVENT_LISTENERS_START_END
//CUSTOM_BEFORE_STATIC_SYSTEM_START_START

View File

@ -5,12 +5,12 @@ const Utils = require('.././r3-utils');
CUSTOM_OPTIONS_START
started=false
subscriptions=[]
subscriptions={}
CUSTOM_OPTIONS_END
CUSTOM_STATIC_OPTIONS_START
Started=false
Subscriptions=[]
Subscriptions={}
CUSTOM_STATIC_OPTIONS_END
CUSTOM_EVENT_LISTENERS_START
@ -43,7 +43,7 @@ class System {
options.started = false;
}
if (typeof options.subscriptions === 'undefined') {
options.subscriptions = [];
options.subscriptions = {};
}
//GENERATED_OPTIONS_INIT_END
@ -81,7 +81,7 @@ class System {
//GENERATED_STATIC_OPTIONS_INIT_START
System.Started = false;
System.Subscriptions = [];
System.Subscriptions = {};
//GENERATED_STATIC_OPTIONS_INIT_END
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START

View File

@ -1,7 +1,5 @@
this.subscriptions.push(
new Event.Subscribe(
EVENT_NAME,
this.CALL_BACK
)
this.subscriptions['EVENT_NAME'] = new Event.Subscribe(
FULL_EVENT_NAME,
SYSTEM_NAME.CALL_BACK
);

View File

@ -1,9 +1,3 @@
this.subscriptions = this.subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(EVENT_NAME) !== true) {
result.push(subscription);
}
return result;
},
[]
);
this.subscriptions['EVENT_NAME'].remove();
delete this.subscriptions['EVENT_NAME'];

View File

@ -1,7 +1,5 @@
SYSTEM_NAME.Subscriptions.push(
new Event.Subscribe(
EVENT_NAME,
SYSTEM_NAME.CALL_BACK
)
SYSTEM_NAME.Subscriptions['EVENT_NAME'] = new Event.Subscribe(
FULL_EVENT_NAME,
SYSTEM_NAME.CALL_BACK
);

View File

@ -1,10 +1,3 @@
SYSTEM_NAME.Subscriptions['EVENT_NAME'].remove();
delete SYSTEM_NAME.Subscriptions['EVENT_NAME'];
SYSTEM_NAME.Subscriptions = SYSTEM_NAME.Subscriptions.reduce(
(result, subscription) => {
if (subscription.remove(EVENT_NAME) !== true) {
result.push(subscription);
}
return result;
},
[]
);

View File

@ -1,5 +1,6 @@
//GENERATED_STATIC_EVENT_LISTENERS_START_START
//GENERATED_STATIC_EVENT_LISTENERS_START_END
//CUSTOM_BEFORE_STATIC_SYSTEM_START_START

View File

@ -19,7 +19,6 @@ 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
@ -69,7 +68,6 @@ 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

View File

@ -1 +1 @@
2.0.163
2.0.176