Render system takes care of DOM
parent
3133154ac0
commit
8b4491e7ec
|
@ -35,3 +35,4 @@ r3 create SystemLinking system_extends System ./r3-system/
|
|||
r3 create SystemRuntime system_extends System ./r3-system/
|
||||
r3 create SystemSocket system_extends System ./r3-system/
|
||||
r3 create Utils base ./
|
||||
r3 create SystemRender system_extends System ./r3-system/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class R3 {
|
||||
static version = '2.0.576';
|
||||
static compileDate = '2021 Sep 11 - 06:43:04 am';
|
||||
static version = '2.0.579';
|
||||
static compileDate = '2021 Sep 11 - 06:49:25 am';
|
||||
}
|
||||
|
||||
class Entity {
|
||||
|
@ -93,9 +93,10 @@ class System {
|
|||
System.SYSTEM_DOM = 0x0;
|
||||
System.SYSTEM_INPUT = 0x1;
|
||||
System.SYSTEM_LINKING = 0x2;
|
||||
System.SYSTEM_RUNTIME = 0x3;
|
||||
System.SYSTEM_SOCKET = 0x4;
|
||||
System.MAX_SYSTEM = 0x5;
|
||||
System.SYSTEM_RENDER = 0x3;
|
||||
System.SYSTEM_RUNTIME = 0x4;
|
||||
System.SYSTEM_SOCKET = 0x5;
|
||||
System.MAX_SYSTEM = 0x6;
|
||||
|
||||
class Event {
|
||||
|
||||
|
@ -2863,6 +2864,124 @@ class SystemLinking extends System {
|
|||
SystemLinking.Started = false;
|
||||
SystemLinking.Subscriptions = {};
|
||||
|
||||
/**
|
||||
|
||||
Class R3.System.Render
|
||||
[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 SystemRender]
|
||||
|
||||
Properties:
|
||||
|
||||
<no properties>
|
||||
|
||||
Static Properties:
|
||||
|
||||
- Started (Default value false)
|
||||
- Subscriptions (Default value {})
|
||||
|
||||
Methods:
|
||||
|
||||
<no methods>
|
||||
|
||||
Static Methods:
|
||||
|
||||
- Start(options)
|
||||
Starts the system by registering subscriptions to events
|
||||
|
||||
- Stop(options)
|
||||
Stops the system by removing these subscriptions to events
|
||||
|
||||
Started=false
|
||||
Subscriptions={}
|
||||
|
||||
**/
|
||||
|
||||
class SystemRender extends System {
|
||||
|
||||
constructor(options) {
|
||||
|
||||
if (typeof options === 'undefined') {
|
||||
options = {};
|
||||
}
|
||||
|
||||
super(options);
|
||||
|
||||
Object.assign(this, options);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Start()
|
||||
* - Starts the system by registering subscriptions to events
|
||||
* @param options
|
||||
*/
|
||||
static Start(options) {
|
||||
|
||||
SystemRender.Subscriptions['INSTANCE_CREATED'] = Event.Subscribe(
|
||||
Event.INSTANCE_CREATED,
|
||||
SystemRender.OnInstanceCreated
|
||||
);
|
||||
|
||||
SystemRender.Started = true;
|
||||
|
||||
console.log('Started system: SystemRender');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop()
|
||||
* - Stops the system by removing these subscriptions to events
|
||||
* @param options
|
||||
*/
|
||||
static Stop(options) {
|
||||
|
||||
SystemRender.Subscriptions['INSTANCE_CREATED'].remove();
|
||||
delete SystemRender.Subscriptions['INSTANCE_CREATED'];
|
||||
|
||||
SystemRender.Started = false;
|
||||
|
||||
console.log('Stopped system: SystemRender');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* OnInstanceCreated()
|
||||
* - Listens to events of type Event.INSTANCE_CREATED and executes this function.
|
||||
* @param object (The event data passed as argument - typically an R3Object)
|
||||
* @return null
|
||||
*/
|
||||
static OnInstanceCreated(object) {
|
||||
|
||||
if (object instanceof R3.Component.DOM) {
|
||||
if (object.runtime instanceof R3.Runtime.DOM.Document) {
|
||||
document.body.appendChild(object.instance);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SystemRender.Started = false;
|
||||
SystemRender.Subscriptions = {};
|
||||
|
||||
/**
|
||||
|
||||
Class R3.System.Runtime
|
||||
|
@ -3415,7 +3534,7 @@ class RuntimeDocument extends RuntimeDOM {
|
|||
canvas.setAttribute('width', component.width);
|
||||
canvas.setAttribute('height', component.height);
|
||||
canvas.setAttribute('style', component.style);
|
||||
document.body.appendChild(canvas);
|
||||
return canvas;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3873,112 +3992,6 @@ Component.COMPONENT_INPUT = 0x7;
|
|||
Component.COMPONENT_TOUCH = 0x8;
|
||||
Component.MAX_COMPONENT = 0x9;
|
||||
|
||||
/**
|
||||
|
||||
Class R3.Event.Object.Component
|
||||
[Inherited from Event]
|
||||
|
||||
Inherited Properties:
|
||||
|
||||
<no inherited properties>
|
||||
|
||||
Inherited Static Properties:
|
||||
|
||||
<no inherited static properties>
|
||||
|
||||
Inherited Methods:
|
||||
|
||||
- initialize()
|
||||
Should raise an event(s) which indicates that this object initialized
|
||||
|
||||
- async(eventId, data, clientCallback, clientErrorCallback)
|
||||
Simply calls 'Async()' passing it the arguments
|
||||
|
||||
- emit(eventId, data, clientCallback, clientErrorCallback)
|
||||
Simply calls 'Emit()' passing it the arguments
|
||||
|
||||
- subscribe(eventId, callback)
|
||||
Simply calls 'Subscribe()' passing it the arguments
|
||||
|
||||
Inherited Static Methods:
|
||||
|
||||
- Async(eventId, data, clientCallback, clientErrorCallback)
|
||||
Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as
|
||||
arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the
|
||||
error as argument.
|
||||
|
||||
- Emit(eventId, data, clientCallback, clientErrorCallback)
|
||||
Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after
|
||||
the event result is obtained, passing it the result. If an exception occurs during execution, the
|
||||
clientErrorCallback is called with the error as argument.
|
||||
|
||||
- Subscribe(eventId, callback)
|
||||
Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised
|
||||
|
||||
[Inherited from R3Object]
|
||||
|
||||
Inherited Properties:
|
||||
|
||||
- id (Default value Utils.RandomId(10))
|
||||
- name (Default value 'Object ' + options.id)
|
||||
- register (Default value true)
|
||||
|
||||
Inherited Static Properties:
|
||||
|
||||
<no inherited static properties>
|
||||
|
||||
Inherited Methods:
|
||||
|
||||
- initialize()
|
||||
Overrides for R3.Event.initialize()
|
||||
|
||||
Inherited Static Methods:
|
||||
|
||||
<no inherited static methods>
|
||||
|
||||
[Belonging to Component]
|
||||
|
||||
Properties:
|
||||
|
||||
<no properties>
|
||||
|
||||
Static Properties:
|
||||
|
||||
<no static properties>
|
||||
|
||||
Methods:
|
||||
|
||||
- initialize()
|
||||
Should raises an event(s) which indicates that this object initialized
|
||||
|
||||
- createInstance()
|
||||
Creates an instance of this object based on the current runtime
|
||||
|
||||
- dispose()
|
||||
Disposes of this object by disposing the instance first.
|
||||
|
||||
- disposeInstance()
|
||||
Disposes of the runtime instance.
|
||||
|
||||
- updateInstance(property)
|
||||
Updates this object by copying the values of its instance into the current object.
|
||||
|
||||
- updateFromInstance(property)
|
||||
Updates this object by copying the values of its instance into the current object.
|
||||
|
||||
- setRuntime()
|
||||
Sets the runtime property of this component required for constructing an instance of this component.
|
||||
|
||||
Static Methods:
|
||||
|
||||
<no static methods>
|
||||
|
||||
**/
|
||||
|
||||
class Component extends R3Object {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Class R3.Event.Object.Project
|
||||
|
@ -6027,7 +6040,6 @@ R3.Event = Event;
|
|||
R3.Utils = Utils;
|
||||
R3.Object = R3Object;
|
||||
R3.Component = Component;
|
||||
R3.Component = Component;
|
||||
R3.Project = Project;
|
||||
R3.DOM = ComponentDOM;
|
||||
R3.Canvas = ComponentCanvas;
|
||||
|
@ -6041,6 +6053,7 @@ R3.Touch = ComponentTouch;
|
|||
System.DOM = SystemDOM;
|
||||
System.Input = SystemInput;
|
||||
System.Linking = SystemLinking;
|
||||
System.Render = SystemRender;
|
||||
System.Runtime = SystemRuntime;
|
||||
System.Socket = SystemSocket;
|
||||
Component.DOM = ComponentDOM;
|
||||
|
@ -6071,5 +6084,6 @@ console.log('r3.js - version ' + R3.version + ' compiled ' + R3.compileDate);
|
|||
SystemDOM.Start();
|
||||
SystemInput.Start();
|
||||
SystemLinking.Start();
|
||||
SystemRender.Start();
|
||||
SystemRuntime.Start();
|
||||
SystemSocket.Start();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "r3",
|
||||
"version" : "2.0.576",
|
||||
"version" : "2.0.579",
|
||||
"description": "",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -7,6 +7,7 @@ console.log('r3.js - version ' + R3.version + ' compiled ' + R3.compileDate);
|
|||
SystemDOM.Start();
|
||||
SystemInput.Start();
|
||||
SystemLinking.Start();
|
||||
SystemRender.Start();
|
||||
SystemRuntime.Start();
|
||||
SystemSocket.Start();
|
||||
//GENERATED_INDEX_BODY_END
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class R3 {
|
||||
static version = '2.0.576';
|
||||
static compileDate = '2021 Sep 11 - 06:43:04 am';
|
||||
static version = '2.0.579';
|
||||
static compileDate = '2021 Sep 11 - 06:49:25 am';
|
||||
}
|
||||
|
||||
//GENERATED_IMPORTS_START
|
||||
|
@ -11,7 +11,6 @@ const Event = require('./r3-event.js');
|
|||
const Utils = require('./r3-utils.js');
|
||||
const R3Object = require('./r3-r3-object.js');
|
||||
const Component = require('./r3-component/');
|
||||
const Component = require('./R3Objectr3-component.js');
|
||||
const Project = require('./r3-project.js');
|
||||
//GENERATED_IMPORTS_END
|
||||
|
||||
|
@ -23,7 +22,6 @@ R3.Event = Event;
|
|||
R3.Utils = Utils;
|
||||
R3.Object = R3Object;
|
||||
R3.Component = Component;
|
||||
R3.Component = Component;
|
||||
R3.Project = Project;
|
||||
R3.DOM = ComponentDOM;
|
||||
R3.Canvas = ComponentCanvas;
|
||||
|
|
|
@ -97,7 +97,7 @@ class RuntimeDocument extends RuntimeDOM {
|
|||
canvas.setAttribute('width', component.width);
|
||||
canvas.setAttribute('height', component.height);
|
||||
canvas.setAttribute('style', component.style);
|
||||
document.body.appendChild(canvas);
|
||||
return canvas;
|
||||
}
|
||||
//CUSTOM_BUILD_INSTANCE_METHOD_END
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ const System = require('./r3-system.js');
|
|||
const SystemDOM = require('./r3-system-d-o-m.js');
|
||||
const SystemInput = require('./r3-system-input.js');
|
||||
const SystemLinking = require('./r3-system-linking.js');
|
||||
const SystemRender = require('./r3-system-render.js');
|
||||
const SystemRuntime = require('./r3-system-runtime.js');
|
||||
const SystemSocket = require('./r3-system-socket.js');
|
||||
//GENERATED_IMPORTS_END
|
||||
|
@ -11,6 +12,7 @@ const SystemSocket = require('./r3-system-socket.js');
|
|||
System.DOM = SystemDOM;
|
||||
System.Input = SystemInput;
|
||||
System.Linking = SystemLinking;
|
||||
System.Render = SystemRender;
|
||||
System.Runtime = SystemRuntime;
|
||||
System.Socket = SystemSocket;
|
||||
//GENERATED_INDEX_BODY_END
|
||||
|
|
|
@ -0,0 +1,213 @@
|
|||
const Event = require('.././r3-event');
|
||||
const Utils = require('.././r3-utils');
|
||||
const System = require('.././r3-system.js');
|
||||
|
||||
/**
|
||||
|
||||
GENERATED_INHERITED_START
|
||||
|
||||
Class R3.System.Render
|
||||
[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 SystemRender]
|
||||
|
||||
Properties:
|
||||
|
||||
<no properties>
|
||||
|
||||
Static Properties:
|
||||
|
||||
- Started (Default value false)
|
||||
- Subscriptions (Default value {})
|
||||
|
||||
Methods:
|
||||
|
||||
<no methods>
|
||||
|
||||
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
|
||||
Started=false
|
||||
Subscriptions={}
|
||||
CUSTOM_STATIC_OPTIONS_END
|
||||
|
||||
CUSTOM_EVENT_LISTENERS_START
|
||||
CUSTOM_EVENT_LISTENERS_END
|
||||
|
||||
CUSTOM_STATIC_EVENT_LISTENERS_START
|
||||
Event.INSTANCE_CREATED
|
||||
CUSTOM_STATIC_EVENT_LISTENERS_END
|
||||
|
||||
CUSTOM_METHODS_START
|
||||
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 SystemRender 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_METHODS_START
|
||||
//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
|
||||
SystemRender.Subscriptions['INSTANCE_CREATED'] = Event.Subscribe(
|
||||
Event.INSTANCE_CREATED,
|
||||
SystemRender.OnInstanceCreated
|
||||
);
|
||||
|
||||
//GENERATED_STATIC_EVENT_LISTENERS_START_END
|
||||
|
||||
//CUSTOM_BEFORE_STATIC_SYSTEM_START_START
|
||||
//CUSTOM_BEFORE_STATIC_SYSTEM_START_END
|
||||
|
||||
SystemRender.Started = true;
|
||||
|
||||
console.log('Started system: SystemRender');
|
||||
|
||||
//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
|
||||
SystemRender.Subscriptions['INSTANCE_CREATED'].remove();
|
||||
delete SystemRender.Subscriptions['INSTANCE_CREATED'];
|
||||
|
||||
//GENERATED_STATIC_EVENT_LISTENERS_STOP_END
|
||||
|
||||
//CUSTOM_BEFORE_STATIC_SYSTEM_STOP_START
|
||||
//CUSTOM_BEFORE_STATIC_SYSTEM_STOP_END
|
||||
|
||||
SystemRender.Started = false;
|
||||
|
||||
console.log('Stopped system: SystemRender');
|
||||
|
||||
//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
|
||||
|
||||
/**
|
||||
* OnInstanceCreated()
|
||||
* - Listens to events of type Event.INSTANCE_CREATED and executes this function.
|
||||
* @param object (The event data passed as argument - typically an R3Object)
|
||||
* @return null
|
||||
*/
|
||||
static OnInstanceCreated(object) {
|
||||
|
||||
//GENERATED_STATIC_ON_INSTANCE_CREATED_METHOD_START
|
||||
//GENERATED_STATIC_ON_INSTANCE_CREATED_METHOD_END
|
||||
|
||||
//CUSTOM_STATIC_ON_INSTANCE_CREATED_METHOD_START
|
||||
if (object instanceof R3.Component.DOM) {
|
||||
if (object.runtime instanceof R3.Runtime.DOM.Document) {
|
||||
document.body.appendChild(object.instance);
|
||||
}
|
||||
}
|
||||
//CUSTOM_STATIC_ON_INSTANCE_CREATED_METHOD_END
|
||||
|
||||
}
|
||||
//GENERATED_STATIC_EVENT_LISTENER_METHODS_END
|
||||
|
||||
//CUSTOM_IMPLEMENTATION_START
|
||||
//CUSTOM_IMPLEMENTATION_END
|
||||
}
|
||||
|
||||
//GENERATED_STATIC_OPTIONS_INIT_START
|
||||
SystemRender.Started = false;
|
||||
SystemRender.Subscriptions = {};
|
||||
//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 = SystemRender;
|
|
@ -72,9 +72,10 @@ class System {
|
|||
System.SYSTEM_DOM = 0x0;
|
||||
System.SYSTEM_INPUT = 0x1;
|
||||
System.SYSTEM_LINKING = 0x2;
|
||||
System.SYSTEM_RUNTIME = 0x3;
|
||||
System.SYSTEM_SOCKET = 0x4;
|
||||
System.MAX_SYSTEM = 0x5;
|
||||
System.SYSTEM_RENDER = 0x3;
|
||||
System.SYSTEM_RUNTIME = 0x4;
|
||||
System.SYSTEM_SOCKET = 0x5;
|
||||
System.MAX_SYSTEM = 0x6;
|
||||
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END
|
||||
|
||||
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
|
||||
|
|
Loading…
Reference in New Issue