215 lines
4.5 KiB
JavaScript
215 lines
4.5 KiB
JavaScript
//GENERATED_IMPORTS_START
|
|
//GENERATED_IMPORTS_END
|
|
|
|
//CUSTOM_IMPORTS_START
|
|
//CUSTOM_IMPORTS_END
|
|
|
|
const Event = require('.././r3-event');
|
|
const System = require('./r3-system.js');
|
|
|
|
/**
|
|
|
|
GENERATED_INHERITED_START
|
|
|
|
Class R3.System.Socket
|
|
[Inherited from System]
|
|
|
|
Inherited Properties:
|
|
|
|
<no inherited properties>
|
|
|
|
Inherited Static Properties:
|
|
|
|
<no inherited static properties>
|
|
|
|
Inherited Methods:
|
|
|
|
<no inherited methods>
|
|
|
|
Inherited Static Methods:
|
|
|
|
<no inherited static methods>
|
|
|
|
[Belonging to SystemSocket]
|
|
|
|
Properties:
|
|
|
|
<no properties>
|
|
|
|
Static Properties:
|
|
|
|
<no static properties>
|
|
|
|
Methods:
|
|
|
|
<no methods>
|
|
|
|
Static Methods:
|
|
|
|
<no static methods>
|
|
|
|
GENERATED_INHERITED_END
|
|
|
|
TEMPLATE_OPTIONS_START
|
|
TEMPLATE_OPTIONS_END
|
|
|
|
CUSTOM_OPTIONS_START
|
|
CUSTOM_OPTIONS_END
|
|
|
|
TEMPLATE_STATIC_OPTIONS_START
|
|
Started=false - Indicates whether or not this system is running or not
|
|
Subscriptions={} - An association object which hold the subscription handles for Events this system is listening to. The system can stop receiving events by calling remove() on a handle.
|
|
TEMPLATE_STATIC_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
|
|
|
|
TEMPLATE_METHODS_START
|
|
TEMPLATE_METHODS_END
|
|
|
|
CUSTOM_METHODS_START
|
|
CUSTOM_METHODS_END
|
|
|
|
TEMPLATE_STATIC_METHODS_START
|
|
Start(options) - Starts the system by registering subscriptions to events
|
|
Stop(options) - Stops the system by removing these subscriptions to events
|
|
TEMPLATE_STATIC_METHODS_END
|
|
|
|
CUSTOM_STATIC_METHODS_START
|
|
CUSTOM_STATIC_METHODS_END
|
|
|
|
**/
|
|
|
|
class SystemSocket extends System {
|
|
|
|
//GENERATED_CONSTRUCTOR_START
|
|
constructor(options) {
|
|
|
|
if (typeof options === 'undefined') {
|
|
options = {};
|
|
}
|
|
|
|
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
|
|
|
|
//CUSTOM_AFTER_INIT_START
|
|
//CUSTOM_AFTER_INIT_END
|
|
}
|
|
//GENERATED_CONSTRUCTOR_END
|
|
|
|
//GENERATED_TEMPLATE_METHODS_START
|
|
//GENERATED_TEMPLATE_METHODS_END
|
|
|
|
//GENERATED_METHODS_START
|
|
//GENERATED_METHODS_END
|
|
|
|
//GENERATED_TEMPLATE_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
|
|
|
|
SystemSocket.Started = true;
|
|
|
|
console.log('Started system: SystemSocket');
|
|
|
|
//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
|
|
|
|
SystemSocket.Started = false;
|
|
|
|
console.log('Stopped system: SystemSocket');
|
|
|
|
//GENERATED_STATIC_STOP_METHOD_END
|
|
|
|
//CUSTOM_STATIC_STOP_METHOD_START
|
|
//CUSTOM_STATIC_STOP_METHOD_END
|
|
|
|
}
|
|
//GENERATED_TEMPLATE_STATIC_METHODS_END
|
|
|
|
//GENERATED_STATIC_METHODS_START
|
|
//GENERATED_STATIC_METHODS_END
|
|
|
|
//GENERATED_EVENT_LISTENER_METHODS_START
|
|
//GENERATED_EVENT_LISTENER_METHODS_END
|
|
|
|
//GENERATED_STATIC_EVENT_LISTENER_METHODS_START
|
|
//GENERATED_STATIC_EVENT_LISTENER_METHODS_END
|
|
|
|
//CUSTOM_IMPLEMENTATION_START
|
|
//CUSTOM_IMPLEMENTATION_END
|
|
}
|
|
|
|
//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START
|
|
/**
|
|
* static Started - Indicates whether or not this system is running or not
|
|
*/
|
|
SystemSocket.Started = false;
|
|
|
|
/**
|
|
* static Subscriptions - An association object which hold the subscription handles for Events this system is
|
|
* listening to. The system can stop receiving events by calling remove() on a handle.
|
|
*/
|
|
SystemSocket.Subscriptions = {};
|
|
|
|
//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END
|
|
|
|
//GENERATED_STATIC_OPTIONS_INIT_START
|
|
//GENERATED_STATIC_OPTIONS_INIT_END
|
|
|
|
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START
|
|
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END
|
|
|
|
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
|
|
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
|
|
|
|
module.exports = SystemSocket;
|