diff --git a/dist/r3.js b/dist/r3.js index 26883e8..029c126 100644 --- a/dist/r3.js +++ b/dist/r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.869'; - static compileDate = '2021 Sep 22 - 13:06:11 pm'; + static version = '2.0.877'; + static compileDate = '2021 Sep 22 - 13:55:35 pm'; } class Runtime { @@ -2281,39 +2281,40 @@ Event.DISPOSE_OBJECT = 0x7; Event.DOM_COMPONENT_INITIALIZED = 0x8; Event.ENTITY_CREATED = 0x9; Event.ENTITY_INITIALIZED = 0xa; -Event.GET_API_URL = 0xb; -Event.GET_RUNTIME = 0xc; -Event.GET_WINDOW_SIZE = 0xd; -Event.GRAPHICS_COMPONENT_INITIALIZED = 0xe; -Event.IMAGE_COMPONENT_INITIALIZED = 0xf; -Event.IMAGE_INSTANCE_CREATED = 0x10; -Event.INPUT_COMPONENT_INITIALIZED = 0x11; -Event.INSTANCE_CREATED = 0x12; -Event.INSTANCE_DISPOSED = 0x13; -Event.KEYBOARD_DOWN = 0x14; -Event.KEYBOARD_UP = 0x15; -Event.MOUSE_DOWN = 0x16; -Event.MOUSE_MOVE = 0x17; -Event.MOUSE_UP = 0x18; -Event.MOUSE_WHEEL = 0x19; -Event.OBJECT_CREATED = 0x1a; -Event.OBJECT_INITIALIZED = 0x1b; -Event.PAUSE = 0x1c; -Event.PROJECT_INITIALIZED = 0x1d; -Event.RESTART = 0x1e; -Event.SLIDER_ENTITY_INITIALIZED = 0x1f; -Event.START = 0x20; -Event.TOUCH_CANCEL = 0x21; -Event.TOUCH_END = 0x22; -Event.TOUCH_MOVE = 0x23; -Event.TOUCH_START = 0x24; -Event.UPDATE_FROM_INSTANCE_AFTER = 0x25; -Event.UPDATE_FROM_INSTANCE_BEFORE = 0x26; -Event.UPDATE_INSTANCE_AFTER = 0x27; -Event.UPDATE_INSTANCE_BEFORE = 0x28; -Event.UPDATE_INSTANCE_PROPERTY = 0x29; -Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2a; -Event.MAX_EVENTS = 0x2b; +Event.ENTITY_STARTED = 0xb; +Event.GET_API_URL = 0xc; +Event.GET_RUNTIME = 0xd; +Event.GET_WINDOW_SIZE = 0xe; +Event.GRAPHICS_COMPONENT_INITIALIZED = 0xf; +Event.IMAGE_COMPONENT_INITIALIZED = 0x10; +Event.IMAGE_INSTANCE_CREATED = 0x11; +Event.INPUT_COMPONENT_INITIALIZED = 0x12; +Event.INSTANCE_CREATED = 0x13; +Event.INSTANCE_DISPOSED = 0x14; +Event.KEYBOARD_DOWN = 0x15; +Event.KEYBOARD_UP = 0x16; +Event.MOUSE_DOWN = 0x17; +Event.MOUSE_MOVE = 0x18; +Event.MOUSE_UP = 0x19; +Event.MOUSE_WHEEL = 0x1a; +Event.OBJECT_CREATED = 0x1b; +Event.OBJECT_INITIALIZED = 0x1c; +Event.PAUSE = 0x1d; +Event.PROJECT_INITIALIZED = 0x1e; +Event.RESTART = 0x1f; +Event.SLIDER_ENTITY_INITIALIZED = 0x20; +Event.START = 0x21; +Event.TOUCH_CANCEL = 0x22; +Event.TOUCH_END = 0x23; +Event.TOUCH_MOVE = 0x24; +Event.TOUCH_START = 0x25; +Event.UPDATE_FROM_INSTANCE_AFTER = 0x26; +Event.UPDATE_FROM_INSTANCE_BEFORE = 0x27; +Event.UPDATE_INSTANCE_AFTER = 0x28; +Event.UPDATE_INSTANCE_BEFORE = 0x29; +Event.UPDATE_INSTANCE_PROPERTY = 0x2a; +Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2b; +Event.MAX_EVENTS = 0x2c; Event.GetEventName = function(eventId) { @@ -2328,38 +2329,39 @@ Event.GetEventName = function(eventId) { case 0x8 : return 'dom_component_initialized'; case 0x9 : return 'entity_created'; case 0xa : return 'entity_initialized'; - case 0xb : return 'get_api_url'; - case 0xc : return 'get_runtime'; - case 0xd : return 'get_window_size'; - case 0xe : return 'graphics_component_initialized'; - case 0xf : return 'image_component_initialized'; - case 0x10 : return 'image_instance_created'; - case 0x11 : return 'input_component_initialized'; - case 0x12 : return 'instance_created'; - case 0x13 : return 'instance_disposed'; - case 0x14 : return 'keyboard_down'; - case 0x15 : return 'keyboard_up'; - case 0x16 : return 'mouse_down'; - case 0x17 : return 'mouse_move'; - case 0x18 : return 'mouse_up'; - case 0x19 : return 'mouse_wheel'; - case 0x1a : return 'object_created'; - case 0x1b : return 'object_initialized'; - case 0x1c : return 'pause'; - case 0x1d : return 'project_initialized'; - case 0x1e : return 'restart'; - case 0x1f : return 'slider_entity_initialized'; - case 0x20 : return 'start'; - case 0x21 : return 'touch_cancel'; - case 0x22 : return 'touch_end'; - case 0x23 : return 'touch_move'; - case 0x24 : return 'touch_start'; - case 0x25 : return 'update_from_instance_after'; - case 0x26 : return 'update_from_instance_before'; - case 0x27 : return 'update_instance_after'; - case 0x28 : return 'update_instance_before'; - case 0x29 : return 'update_instance_property'; - case 0x2a : return 'update_property_from_instance'; + case 0xb : return 'entity_started'; + case 0xc : return 'get_api_url'; + case 0xd : return 'get_runtime'; + case 0xe : return 'get_window_size'; + case 0xf : return 'graphics_component_initialized'; + case 0x10 : return 'image_component_initialized'; + case 0x11 : return 'image_instance_created'; + case 0x12 : return 'input_component_initialized'; + case 0x13 : return 'instance_created'; + case 0x14 : return 'instance_disposed'; + case 0x15 : return 'keyboard_down'; + case 0x16 : return 'keyboard_up'; + case 0x17 : return 'mouse_down'; + case 0x18 : return 'mouse_move'; + case 0x19 : return 'mouse_up'; + case 0x1a : return 'mouse_wheel'; + case 0x1b : return 'object_created'; + case 0x1c : return 'object_initialized'; + case 0x1d : return 'pause'; + case 0x1e : return 'project_initialized'; + case 0x1f : return 'restart'; + case 0x20 : return 'slider_entity_initialized'; + case 0x21 : return 'start'; + case 0x22 : return 'touch_cancel'; + case 0x23 : return 'touch_end'; + case 0x24 : return 'touch_move'; + case 0x25 : return 'touch_start'; + case 0x26 : return 'update_from_instance_after'; + case 0x27 : return 'update_from_instance_before'; + case 0x28 : return 'update_instance_after'; + case 0x29 : return 'update_instance_before'; + case 0x2a : return 'update_instance_property'; + case 0x2b : return 'update_property_from_instance'; default : throw new Error('Event type not defined : ' + eventId); } @@ -2554,22 +2556,28 @@ class Entity extends R3Object { constructor(options) { + super(options); + if (typeof options === 'undefined') { options = {}; } + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + if (typeof options.callDepth === 'undefined') { options.callDepth = 0; } else { options.callDepth++; } - super(options); - - this.emit(Event.ENTITY_CREATED, this); + options.maxDepth = options.callDepth; Object.assign(this, options); + this.emit(Event.ENTITY_CREATED, this); + if (options.callDepth === 0) { this.initialize(); } else { @@ -2589,11 +2597,7 @@ class Entity extends R3Object { Event.Emit(Event.ENTITY_INITIALIZED, this); if (this.initializeDepth === this.maxDepth) { - - if (this instanceof R3.Component) { - this.createInstance(); - } - + throw new Error('You should not try to instantiate this base class - extend it rather...'); } else { this.initializeDepth++; } @@ -2715,6 +2719,10 @@ class EntitySlider extends Entity { options = {}; } + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + if (typeof options.initialized === 'undefined') { options.initialized = false; } @@ -2725,8 +2733,20 @@ class EntitySlider extends Entity { options.callDepth++; } - super(options); + options.maxDepth = options.callDepth; + /** + * initialized - A boolean which indicates whether or not this entity has initialized + */ + if (typeof options.initialized === 'undefined') { + options.initialized = false; + } + /** + * initializeDepth - The amount of times this component passed through initialize() functions + */ + if (typeof options.initializeDepth === 'undefined') { + options.initializeDepth = 0; + } /** * parent - The parent R3.Object of this component */ @@ -2753,6 +2773,8 @@ class EntitySlider extends Entity { options.subscriptions = {}; } + super(options); + /** * canvas - The Canvas Component to which this entity binds its custom code components */ @@ -2830,6 +2852,13 @@ class EntitySlider extends Entity { this.started = true; + if (this instanceof R3.Entity) { + this.emit( + Event.ENTITY_STARTED, + this + ); + } + console.log('Started transient system: EntitySlider'); } @@ -3022,11 +3051,7 @@ class Component extends R3Object { Event.Emit(Event.COMPONENT_INITIALIZED, this); if (this.initializeDepth === this.maxDepth) { - - if (this instanceof R3.Component) { - this.createInstance(); - } - + throw new Error('You should not try to instantiate this base class - extend it rather...'); } else { this.initializeDepth++; } @@ -3258,12 +3283,6 @@ class ComponentDOM extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -3306,6 +3325,10 @@ class ComponentDOM extends Component { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -3336,21 +3359,6 @@ class ComponentDOM extends Component { } } - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_INSTANCE_AFTER, this); } @@ -3379,21 +3387,6 @@ class ComponentDOM extends Component { } } - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); } @@ -3553,12 +3546,6 @@ class ComponentCanvas extends ComponentDOM { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -3617,6 +3604,10 @@ class ComponentCanvas extends ComponentDOM { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -3675,21 +3666,6 @@ class ComponentCanvas extends ComponentDOM { } } - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_INSTANCE_AFTER, this); } @@ -3746,21 +3722,6 @@ class ComponentCanvas extends ComponentDOM { } } - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); } @@ -3898,12 +3859,6 @@ class ComponentGraphics extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -3939,6 +3894,10 @@ class ComponentGraphics extends Component { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -3954,21 +3913,6 @@ class ComponentGraphics extends Component { this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_INSTANCE_AFTER, this); } @@ -3982,21 +3926,6 @@ class ComponentGraphics extends Component { this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); } @@ -4168,12 +4097,6 @@ class ComponentImage extends ComponentGraphics { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -4300,6 +4223,10 @@ class ComponentImage extends ComponentGraphics { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -4428,21 +4355,6 @@ class ComponentImage extends ComponentGraphics { } } - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_INSTANCE_AFTER, this); } @@ -4569,21 +4481,6 @@ class ComponentImage extends ComponentGraphics { } } - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); } @@ -4739,12 +4636,6 @@ class ComponentMaterial extends ComponentGraphics { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -4778,6 +4669,10 @@ class ComponentMaterial extends ComponentGraphics { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -4793,21 +4688,6 @@ class ComponentMaterial extends ComponentGraphics { this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_INSTANCE_AFTER, this); } @@ -4821,21 +4701,6 @@ class ComponentMaterial extends ComponentGraphics { this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); } @@ -4991,12 +4856,6 @@ class ComponentMesh extends ComponentGraphics { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -5030,6 +4889,10 @@ class ComponentMesh extends ComponentGraphics { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -5045,21 +4908,6 @@ class ComponentMesh extends ComponentGraphics { this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_INSTANCE_AFTER, this); } @@ -5073,21 +4921,6 @@ class ComponentMesh extends ComponentGraphics { this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); } @@ -5243,12 +5076,6 @@ class ComponentTexture extends ComponentGraphics { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -5282,6 +5109,10 @@ class ComponentTexture extends ComponentGraphics { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -5297,21 +5128,6 @@ class ComponentTexture extends ComponentGraphics { this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_INSTANCE_AFTER, this); } @@ -5325,21 +5141,6 @@ class ComponentTexture extends ComponentGraphics { this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); } @@ -5477,12 +5278,6 @@ class ComponentInput extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -5518,6 +5313,10 @@ class ComponentInput extends Component { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -5533,21 +5332,6 @@ class ComponentInput extends Component { this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_INSTANCE_AFTER, this); } @@ -5561,21 +5345,6 @@ class ComponentInput extends Component { this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); } @@ -5731,12 +5500,6 @@ class ComponentTouch extends ComponentInput { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -5770,6 +5533,10 @@ class ComponentTouch extends ComponentInput { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -5785,21 +5552,6 @@ class ComponentTouch extends ComponentInput { this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_INSTANCE_AFTER, this); } @@ -5813,21 +5565,6 @@ class ComponentTouch extends ComponentInput { this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); } @@ -5965,12 +5702,6 @@ class ComponentCode extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -6004,6 +5735,10 @@ class ComponentCode extends Component { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -6019,21 +5754,6 @@ class ComponentCode extends Component { this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_INSTANCE_AFTER, this); } @@ -6047,21 +5767,6 @@ class ComponentCode extends Component { this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); } @@ -6177,6 +5882,10 @@ class Project extends R3Object { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } diff --git a/package.json b/package.json index 9425edd..237e06d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "r3", - "version" : "2.0.869", + "version" : "2.0.877", "description": "", "private": true, "dependencies": { diff --git a/r3.php b/r3.php index 3a910e5..7a66539 100755 --- a/r3.php +++ b/r3.php @@ -939,6 +939,70 @@ function getMethodDetails($item) } +function getMethodTemplate($token, &$updated, $methodTokenName) +{ + global $baseExtends; + + $staticNormal = ''; + + if ($token === 'CUSTOM_STATIC_METHODS' || $token === 'TEMPLATE_STATIC_METHODS') { + $staticNormal = 'static_'; + } + + $templateFound = false; + + /** + * Do before function + */ + $potentialTemplate = strtolower('src/templates/' . $staticNormal . $baseExtends . '_' . $methodTokenName . '.template'); + + if (file_exists($potentialTemplate)) { + $templateFound = true; + } + + if (!$templateFound) { + $potentialTemplate = strtolower('src/templates/' . $staticNormal . $methodTokenName . '.template'); + } + + if (file_exists($potentialTemplate)) { + $templateFound = true; + } + + if ($templateFound) { + $functionTemplate = file_get_contents($potentialTemplate); + $updated = preg_replace('/^\s*\bFUNCTION_TEMPLATE\b/m', $functionTemplate, $updated); + } else { + $updated = preg_replace('/^.*?\bFUNCTION_TEMPLATE\b.*\n/m', '', $updated); + } + + $templateFound = false; + + /** + * Do after function + */ + $potentialTemplate = strtolower('src/templates/' . $staticNormal . $baseExtends . '_' . $methodTokenName . '_after.template'); + + if (file_exists($potentialTemplate)) { + $templateFound = true; + } + + if (!$templateFound) { + $potentialTemplate = strtolower('src/templates/' . $staticNormal . $methodTokenName . '_after.template'); + } + + if (file_exists($potentialTemplate)) { + $templateFound = true; + } + + if ($templateFound) { + $functionTemplate = file_get_contents($potentialTemplate); + $updated = preg_replace('/^\s*\bFUNCTION_TEMPLATE_AFTER\b/m', $functionTemplate, $updated); + } else { + $updated = preg_replace('/^.*?\bFUNCTION_TEMPLATE_AFTER\b.*\n/m', '', $updated); + } + +} + /** * @param $template * @param $tokens @@ -988,55 +1052,7 @@ function doMethodUpdate($template, $tokens, $token) $updated = $template; - if ($token === 'CUSTOM_METHODS' || $token === 'TEMPLATE_METHODS') { - $potentialTemplate = strtolower('src/templates/' . $methodTokenName . '.template'); - } else if ($token === 'CUSTOM_STATIC_METHODS' || $token === 'TEMPLATE_STATIC_METHODS') { - $potentialTemplate = strtolower('src/templates/static_' . $methodTokenName . '.template'); - } - - if (file_exists($potentialTemplate)) { - $functionTemplate = file_get_contents($potentialTemplate); - $updated = preg_replace('/^\s*\bFUNCTION_TEMPLATE\b/m', $functionTemplate, $updated); - } else { - - if ($token === 'CUSTOM_METHODS' || $token === 'TEMPLATE_METHODS') { - $potentialTemplate = strtolower('src/templates/' . $baseExtends . '_' . $methodTokenName . '.template'); - } else if ($token === 'CUSTOM_STATIC_METHODS' || $token === 'TEMPLATE_STATIC_METHODS') { - $potentialTemplate = strtolower('src/templates/static_' . $baseExtends . '_' . $methodTokenName . '.template'); - } - - if (file_exists($potentialTemplate)) { - $functionTemplate = file_get_contents($potentialTemplate); - $updated = preg_replace('/^\s*\bFUNCTION_TEMPLATE\b/m', $functionTemplate, $updated); - } else { - $updated = preg_replace('/^.*?\bFUNCTION_TEMPLATE\b.*\n/m', '', $updated); - } - } - - if ($token === 'CUSTOM_METHODS' || $token === 'TEMPLATE_METHODS') { - $potentialTemplate = strtolower('src/templates/' . $methodTokenName . '_after.template'); - } else if ($token === 'CUSTOM_STATIC_METHODS' || $token === 'TEMPLATE_STATIC_METHODS') { - $potentialTemplate = strtolower('src/templates/static_' . $methodTokenName . '_after.template'); - } - - if (file_exists($potentialTemplate)) { - $functionTemplate = file_get_contents($potentialTemplate); - $updated = preg_replace('/^\s*\bFUNCTION_TEMPLATE_AFTER\b/m', $functionTemplate, $updated); - } else { - - if ($token === 'CUSTOM_METHODS' || $token === 'TEMPLATE_METHODS') { - $potentialTemplate = strtolower('src/templates/' . $baseExtends . '_' . $methodTokenName . '_after.template'); - } else if ($token === 'CUSTOM_STATIC_METHODS' || $token === 'TEMPLATE_STATIC_METHODS') { - $potentialTemplate = strtolower('src/templates/static_' . $baseExtends . '_' . $methodTokenName . '_after.template'); - } - - if (file_exists($potentialTemplate)) { - $functionTemplate = file_get_contents($potentialTemplate); - $updated = preg_replace('/^\s*\bFUNCTION_TEMPLATE_AFTER\b/m', $functionTemplate, $updated); - } else { - $updated = preg_replace('/^.*?\bFUNCTION_TEMPLATE_AFTER\b.*\n/m', '', $updated); - } - } + getMethodTemplate($token, $updated, $methodTokenName); $updated = str_replace('METHOD_ARGS', $args, $updated); $updated = str_replace('METHOD_NAME_UPPERCASE', $methodTokenName, $updated); diff --git a/src/r3/r3-component-code.js b/src/r3/r3-component-code.js index 60c12ba..833e350 100644 --- a/src/r3/r3-component-code.js +++ b/src/r3/r3-component-code.js @@ -106,7 +106,6 @@ const Component = require('./r3-component.js'); TEMPLATE_OPTIONS_START initialized=false - A boolean which indicates whether or not this component has initialized instance=null - Holds the current instance of this object as determined (built) by the runtime object. - maxDepth=options.callDepth - Indicates the maximum call depth of this component initializeDepth=0 - The amount of times this component passed through initialize() functions TEMPLATE_OPTIONS_END @@ -185,12 +184,6 @@ class ComponentCode extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -245,6 +238,10 @@ class ComponentCode extends Component { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -266,20 +263,6 @@ class ComponentCode extends Component { //GENERATED_UPDATE_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_INSTANCE_AFTER, this); @@ -307,20 +290,6 @@ class ComponentCode extends Component { //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); diff --git a/src/r3/r3-component/r3-component-canvas.js b/src/r3/r3-component/r3-component-canvas.js index f922fd8..20c4576 100644 --- a/src/r3/r3-component/r3-component-canvas.js +++ b/src/r3/r3-component/r3-component-canvas.js @@ -128,7 +128,6 @@ const ComponentDOM = require('.././r3-component-d-o-m.js'); TEMPLATE_OPTIONS_START initialized=false - A boolean which indicates whether or not this component has initialized instance=null - Holds the current instance of this object as determined (built) by the runtime object. - maxDepth=options.callDepth - Indicates the maximum call depth of this component initializeDepth=0 - The amount of times this component passed through initialize() functions TEMPLATE_OPTIONS_END @@ -212,12 +211,6 @@ class ComponentCanvas extends ComponentDOM { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -296,6 +289,10 @@ class ComponentCanvas extends ComponentDOM { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -359,20 +356,6 @@ class ComponentCanvas extends ComponentDOM { //GENERATED_UPDATE_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_INSTANCE_AFTER, this); @@ -442,20 +425,6 @@ class ComponentCanvas extends ComponentDOM { //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); diff --git a/src/r3/r3-component/r3-component-d-o-m.js b/src/r3/r3-component/r3-component-d-o-m.js index f4f9d99..2ae54a8 100644 --- a/src/r3/r3-component/r3-component-d-o-m.js +++ b/src/r3/r3-component/r3-component-d-o-m.js @@ -107,7 +107,6 @@ const Component = require('.././r3-component.js'); TEMPLATE_OPTIONS_START initialized=false - A boolean which indicates whether or not this component has initialized instance=null - Holds the current instance of this object as determined (built) by the runtime object. - maxDepth=options.callDepth - Indicates the maximum call depth of this component initializeDepth=0 - The amount of times this component passed through initialize() functions TEMPLATE_OPTIONS_END @@ -187,12 +186,6 @@ class ComponentDOM extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -254,6 +247,10 @@ class ComponentDOM extends Component { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -289,20 +286,6 @@ class ComponentDOM extends Component { //GENERATED_UPDATE_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_INSTANCE_AFTER, this); @@ -344,20 +327,6 @@ class ComponentDOM extends Component { //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); diff --git a/src/r3/r3-component/r3-component-graphics.js b/src/r3/r3-component/r3-component-graphics.js index 8b09ef2..3bf5f81 100644 --- a/src/r3/r3-component/r3-component-graphics.js +++ b/src/r3/r3-component/r3-component-graphics.js @@ -106,7 +106,6 @@ const Component = require('.././r3-component.js'); TEMPLATE_OPTIONS_START initialized=false - A boolean which indicates whether or not this component has initialized instance=null - Holds the current instance of this object as determined (built) by the runtime object. - maxDepth=options.callDepth - Indicates the maximum call depth of this component initializeDepth=0 - The amount of times this component passed through initialize() functions TEMPLATE_OPTIONS_END @@ -185,12 +184,6 @@ class ComponentGraphics extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -246,6 +239,10 @@ class ComponentGraphics extends Component { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -267,20 +264,6 @@ class ComponentGraphics extends Component { //GENERATED_UPDATE_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_INSTANCE_AFTER, this); @@ -308,20 +291,6 @@ class ComponentGraphics extends Component { //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); diff --git a/src/r3/r3-component/r3-component-image.js b/src/r3/r3-component/r3-component-image.js index 67035b6..6733cef 100644 --- a/src/r3/r3-component/r3-component-image.js +++ b/src/r3/r3-component/r3-component-image.js @@ -140,7 +140,6 @@ const ComponentGraphics = require('.././r3-component-graphics.js'); TEMPLATE_OPTIONS_START initialized=false - A boolean which indicates whether or not this component has initialized instance=null - Holds the current instance of this object as determined (built) by the runtime object. - maxDepth=options.callDepth - Indicates the maximum call depth of this component initializeDepth=0 - The amount of times this component passed through initialize() functions TEMPLATE_OPTIONS_END @@ -234,12 +233,6 @@ class ComponentImage extends ComponentGraphics { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -387,6 +380,10 @@ class ComponentImage extends ComponentGraphics { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -520,20 +517,6 @@ class ComponentImage extends ComponentGraphics { //GENERATED_UPDATE_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_INSTANCE_AFTER, this); @@ -673,20 +656,6 @@ class ComponentImage extends ComponentGraphics { //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); diff --git a/src/r3/r3-component/r3-component-input.js b/src/r3/r3-component/r3-component-input.js index 34cee60..15c85f7 100644 --- a/src/r3/r3-component/r3-component-input.js +++ b/src/r3/r3-component/r3-component-input.js @@ -106,7 +106,6 @@ const Component = require('.././r3-component.js'); TEMPLATE_OPTIONS_START initialized=false - A boolean which indicates whether or not this component has initialized instance=null - Holds the current instance of this object as determined (built) by the runtime object. - maxDepth=options.callDepth - Indicates the maximum call depth of this component initializeDepth=0 - The amount of times this component passed through initialize() functions TEMPLATE_OPTIONS_END @@ -185,12 +184,6 @@ class ComponentInput extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -246,6 +239,10 @@ class ComponentInput extends Component { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -267,20 +264,6 @@ class ComponentInput extends Component { //GENERATED_UPDATE_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_INSTANCE_AFTER, this); @@ -308,20 +291,6 @@ class ComponentInput extends Component { //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); diff --git a/src/r3/r3-component/r3-component-material.js b/src/r3/r3-component/r3-component-material.js index d9f5183..96703ce 100644 --- a/src/r3/r3-component/r3-component-material.js +++ b/src/r3/r3-component/r3-component-material.js @@ -124,7 +124,6 @@ const ComponentGraphics = require('.././r3-component-graphics.js'); TEMPLATE_OPTIONS_START initialized=false - A boolean which indicates whether or not this component has initialized instance=null - Holds the current instance of this object as determined (built) by the runtime object. - maxDepth=options.callDepth - Indicates the maximum call depth of this component initializeDepth=0 - The amount of times this component passed through initialize() functions TEMPLATE_OPTIONS_END @@ -203,12 +202,6 @@ class ComponentMaterial extends ComponentGraphics { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -263,6 +256,10 @@ class ComponentMaterial extends ComponentGraphics { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -284,20 +281,6 @@ class ComponentMaterial extends ComponentGraphics { //GENERATED_UPDATE_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_INSTANCE_AFTER, this); @@ -325,20 +308,6 @@ class ComponentMaterial extends ComponentGraphics { //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); diff --git a/src/r3/r3-component/r3-component-mesh.js b/src/r3/r3-component/r3-component-mesh.js index f6f4a2e..50a1892 100644 --- a/src/r3/r3-component/r3-component-mesh.js +++ b/src/r3/r3-component/r3-component-mesh.js @@ -124,7 +124,6 @@ const ComponentGraphics = require('.././r3-component-graphics.js'); TEMPLATE_OPTIONS_START initialized=false - A boolean which indicates whether or not this component has initialized instance=null - Holds the current instance of this object as determined (built) by the runtime object. - maxDepth=options.callDepth - Indicates the maximum call depth of this component initializeDepth=0 - The amount of times this component passed through initialize() functions TEMPLATE_OPTIONS_END @@ -203,12 +202,6 @@ class ComponentMesh extends ComponentGraphics { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -263,6 +256,10 @@ class ComponentMesh extends ComponentGraphics { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -284,20 +281,6 @@ class ComponentMesh extends ComponentGraphics { //GENERATED_UPDATE_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_INSTANCE_AFTER, this); @@ -325,20 +308,6 @@ class ComponentMesh extends ComponentGraphics { //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); diff --git a/src/r3/r3-component/r3-component-texture.js b/src/r3/r3-component/r3-component-texture.js index 9fd9d36..e39e31e 100644 --- a/src/r3/r3-component/r3-component-texture.js +++ b/src/r3/r3-component/r3-component-texture.js @@ -124,7 +124,6 @@ const ComponentGraphics = require('.././r3-component-graphics.js'); TEMPLATE_OPTIONS_START initialized=false - A boolean which indicates whether or not this component has initialized instance=null - Holds the current instance of this object as determined (built) by the runtime object. - maxDepth=options.callDepth - Indicates the maximum call depth of this component initializeDepth=0 - The amount of times this component passed through initialize() functions TEMPLATE_OPTIONS_END @@ -203,12 +202,6 @@ class ComponentTexture extends ComponentGraphics { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -263,6 +256,10 @@ class ComponentTexture extends ComponentGraphics { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -284,20 +281,6 @@ class ComponentTexture extends ComponentGraphics { //GENERATED_UPDATE_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_INSTANCE_AFTER, this); @@ -325,20 +308,6 @@ class ComponentTexture extends ComponentGraphics { //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); diff --git a/src/r3/r3-component/r3-component-touch.js b/src/r3/r3-component/r3-component-touch.js index 93e94d0..745faee 100644 --- a/src/r3/r3-component/r3-component-touch.js +++ b/src/r3/r3-component/r3-component-touch.js @@ -124,7 +124,6 @@ const ComponentInput = require('.././r3-component-input.js'); TEMPLATE_OPTIONS_START initialized=false - A boolean which indicates whether or not this component has initialized instance=null - Holds the current instance of this object as determined (built) by the runtime object. - maxDepth=options.callDepth - Indicates the maximum call depth of this component initializeDepth=0 - The amount of times this component passed through initialize() functions TEMPLATE_OPTIONS_END @@ -203,12 +202,6 @@ class ComponentTouch extends ComponentInput { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * maxDepth - Indicates the maximum call depth of this component - */ - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = options.callDepth; - } /** * initializeDepth - The amount of times this component passed through initialize() functions */ @@ -263,6 +256,10 @@ class ComponentTouch extends ComponentInput { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } @@ -284,20 +281,6 @@ class ComponentTouch extends ComponentInput { //GENERATED_UPDATE_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START - if (property === 'maxDepth') { - this.instance.maxDepth = this.maxDepth; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_INSTANCE_AFTER, this); @@ -325,20 +308,6 @@ class ComponentTouch extends ComponentInput { //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START - if (property === 'maxDepth' || property === 'all') { - this.maxDepth = this.instance.maxDepth; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'maxDepth', - instanceProperty : 'maxDepth' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); diff --git a/src/r3/r3-component/r3-component.js b/src/r3/r3-component/r3-component.js index cedcd8d..9120a6e 100644 --- a/src/r3/r3-component/r3-component.js +++ b/src/r3/r3-component/r3-component.js @@ -180,11 +180,7 @@ class Component extends R3Object { //GENERATED_INITIALIZE_METHOD_AFTER_START if (this.initializeDepth === this.maxDepth) { - - if (this instanceof R3.Component) { - this.createInstance(); - } - + throw new Error('You should not try to instantiate this base class - extend it rather...'); } else { this.initializeDepth++; } diff --git a/src/r3/r3-entity/r3-entity-slider.js b/src/r3/r3-entity/r3-entity-slider.js index 2d49ebf..1a75096 100644 --- a/src/r3/r3-entity/r3-entity-slider.js +++ b/src/r3/r3-entity/r3-entity-slider.js @@ -107,6 +107,8 @@ const Entity = require('.././r3-entity.js'); GENERATED_INHERITED_END TEMPLATE_OPTIONS_START + initialized=false - A boolean which indicates whether or not this entity has initialized + initializeDepth=0 - The amount of times this component passed through initialize() functions parent=null - The parent R3.Object of this component components=[] - A list of components that this entity is composed of started=false - Indicates whether or not this entity is active (subscribing to events) or not @@ -157,6 +159,10 @@ class EntitySlider extends Entity { options = {}; } + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + if (typeof options.initialized === 'undefined') { options.initialized = false; } @@ -167,9 +173,21 @@ class EntitySlider extends Entity { options.callDepth++; } - super(options); + options.maxDepth = options.callDepth; //GENERATED_TEMPLATE_OPTIONS_INIT_START + /** + * initialized - A boolean which indicates whether or not this entity has initialized + */ + if (typeof options.initialized === 'undefined') { + options.initialized = false; + } + /** + * initializeDepth - The amount of times this component passed through initialize() functions + */ + if (typeof options.initializeDepth === 'undefined') { + options.initializeDepth = 0; + } /** * parent - The parent R3.Object of this component */ @@ -197,6 +215,8 @@ class EntitySlider extends Entity { } //GENERATED_TEMPLATE_OPTIONS_INIT_END + super(options); + //GENERATED_OPTIONS_INIT_START /** * canvas - The Canvas Component to which this entity binds its custom code components @@ -301,6 +321,13 @@ class EntitySlider extends Entity { this.started = true; + if (this instanceof R3.Entity) { + this.emit( + Event.ENTITY_STARTED, + this + ); + } + console.log('Started transient system: EntitySlider'); //GENERATED_START_METHOD_END diff --git a/src/r3/r3-entity/r3-entity.js b/src/r3/r3-entity/r3-entity.js index daccdf3..696c062 100644 --- a/src/r3/r3-entity/r3-entity.js +++ b/src/r3/r3-entity/r3-entity.js @@ -117,19 +117,23 @@ class Entity extends R3Object { //GENERATED_CONSTRUCTOR_START constructor(options) { + super(options); + if (typeof options === 'undefined') { options = {}; } + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + if (typeof options.callDepth === 'undefined') { options.callDepth = 0; } else { options.callDepth++; } - super(options); - - this.emit(Event.ENTITY_CREATED, this); + options.maxDepth = options.callDepth; //GENERATED_TEMPLATE_OPTIONS_INIT_START //GENERATED_TEMPLATE_OPTIONS_INIT_END @@ -142,6 +146,8 @@ class Entity extends R3Object { Object.assign(this, options); + this.emit(Event.ENTITY_CREATED, this); + //CUSTOM_BEFORE_INIT_START //CUSTOM_BEFORE_INIT_END @@ -174,11 +180,7 @@ class Entity extends R3Object { //GENERATED_INITIALIZE_METHOD_AFTER_START if (this.initializeDepth === this.maxDepth) { - - if (this instanceof R3.Component) { - this.createInstance(); - } - + throw new Error('You should not try to instantiate this base class - extend it rather...'); } else { this.initializeDepth++; } diff --git a/src/r3/r3-event.js b/src/r3/r3-event.js index 04d2ac6..51bcdf1 100644 --- a/src/r3/r3-event.js +++ b/src/r3/r3-event.js @@ -355,39 +355,40 @@ Event.DISPOSE_OBJECT = 0x7; Event.DOM_COMPONENT_INITIALIZED = 0x8; Event.ENTITY_CREATED = 0x9; Event.ENTITY_INITIALIZED = 0xa; -Event.GET_API_URL = 0xb; -Event.GET_RUNTIME = 0xc; -Event.GET_WINDOW_SIZE = 0xd; -Event.GRAPHICS_COMPONENT_INITIALIZED = 0xe; -Event.IMAGE_COMPONENT_INITIALIZED = 0xf; -Event.IMAGE_INSTANCE_CREATED = 0x10; -Event.INPUT_COMPONENT_INITIALIZED = 0x11; -Event.INSTANCE_CREATED = 0x12; -Event.INSTANCE_DISPOSED = 0x13; -Event.KEYBOARD_DOWN = 0x14; -Event.KEYBOARD_UP = 0x15; -Event.MOUSE_DOWN = 0x16; -Event.MOUSE_MOVE = 0x17; -Event.MOUSE_UP = 0x18; -Event.MOUSE_WHEEL = 0x19; -Event.OBJECT_CREATED = 0x1a; -Event.OBJECT_INITIALIZED = 0x1b; -Event.PAUSE = 0x1c; -Event.PROJECT_INITIALIZED = 0x1d; -Event.RESTART = 0x1e; -Event.SLIDER_ENTITY_INITIALIZED = 0x1f; -Event.START = 0x20; -Event.TOUCH_CANCEL = 0x21; -Event.TOUCH_END = 0x22; -Event.TOUCH_MOVE = 0x23; -Event.TOUCH_START = 0x24; -Event.UPDATE_FROM_INSTANCE_AFTER = 0x25; -Event.UPDATE_FROM_INSTANCE_BEFORE = 0x26; -Event.UPDATE_INSTANCE_AFTER = 0x27; -Event.UPDATE_INSTANCE_BEFORE = 0x28; -Event.UPDATE_INSTANCE_PROPERTY = 0x29; -Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2a; -Event.MAX_EVENTS = 0x2b; +Event.ENTITY_STARTED = 0xb; +Event.GET_API_URL = 0xc; +Event.GET_RUNTIME = 0xd; +Event.GET_WINDOW_SIZE = 0xe; +Event.GRAPHICS_COMPONENT_INITIALIZED = 0xf; +Event.IMAGE_COMPONENT_INITIALIZED = 0x10; +Event.IMAGE_INSTANCE_CREATED = 0x11; +Event.INPUT_COMPONENT_INITIALIZED = 0x12; +Event.INSTANCE_CREATED = 0x13; +Event.INSTANCE_DISPOSED = 0x14; +Event.KEYBOARD_DOWN = 0x15; +Event.KEYBOARD_UP = 0x16; +Event.MOUSE_DOWN = 0x17; +Event.MOUSE_MOVE = 0x18; +Event.MOUSE_UP = 0x19; +Event.MOUSE_WHEEL = 0x1a; +Event.OBJECT_CREATED = 0x1b; +Event.OBJECT_INITIALIZED = 0x1c; +Event.PAUSE = 0x1d; +Event.PROJECT_INITIALIZED = 0x1e; +Event.RESTART = 0x1f; +Event.SLIDER_ENTITY_INITIALIZED = 0x20; +Event.START = 0x21; +Event.TOUCH_CANCEL = 0x22; +Event.TOUCH_END = 0x23; +Event.TOUCH_MOVE = 0x24; +Event.TOUCH_START = 0x25; +Event.UPDATE_FROM_INSTANCE_AFTER = 0x26; +Event.UPDATE_FROM_INSTANCE_BEFORE = 0x27; +Event.UPDATE_INSTANCE_AFTER = 0x28; +Event.UPDATE_INSTANCE_BEFORE = 0x29; +Event.UPDATE_INSTANCE_PROPERTY = 0x2a; +Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2b; +Event.MAX_EVENTS = 0x2c; Event.GetEventName = function(eventId) { @@ -402,38 +403,39 @@ Event.GetEventName = function(eventId) { case 0x8 : return 'dom_component_initialized'; case 0x9 : return 'entity_created'; case 0xa : return 'entity_initialized'; - case 0xb : return 'get_api_url'; - case 0xc : return 'get_runtime'; - case 0xd : return 'get_window_size'; - case 0xe : return 'graphics_component_initialized'; - case 0xf : return 'image_component_initialized'; - case 0x10 : return 'image_instance_created'; - case 0x11 : return 'input_component_initialized'; - case 0x12 : return 'instance_created'; - case 0x13 : return 'instance_disposed'; - case 0x14 : return 'keyboard_down'; - case 0x15 : return 'keyboard_up'; - case 0x16 : return 'mouse_down'; - case 0x17 : return 'mouse_move'; - case 0x18 : return 'mouse_up'; - case 0x19 : return 'mouse_wheel'; - case 0x1a : return 'object_created'; - case 0x1b : return 'object_initialized'; - case 0x1c : return 'pause'; - case 0x1d : return 'project_initialized'; - case 0x1e : return 'restart'; - case 0x1f : return 'slider_entity_initialized'; - case 0x20 : return 'start'; - case 0x21 : return 'touch_cancel'; - case 0x22 : return 'touch_end'; - case 0x23 : return 'touch_move'; - case 0x24 : return 'touch_start'; - case 0x25 : return 'update_from_instance_after'; - case 0x26 : return 'update_from_instance_before'; - case 0x27 : return 'update_instance_after'; - case 0x28 : return 'update_instance_before'; - case 0x29 : return 'update_instance_property'; - case 0x2a : return 'update_property_from_instance'; + case 0xb : return 'entity_started'; + case 0xc : return 'get_api_url'; + case 0xd : return 'get_runtime'; + case 0xe : return 'get_window_size'; + case 0xf : return 'graphics_component_initialized'; + case 0x10 : return 'image_component_initialized'; + case 0x11 : return 'image_instance_created'; + case 0x12 : return 'input_component_initialized'; + case 0x13 : return 'instance_created'; + case 0x14 : return 'instance_disposed'; + case 0x15 : return 'keyboard_down'; + case 0x16 : return 'keyboard_up'; + case 0x17 : return 'mouse_down'; + case 0x18 : return 'mouse_move'; + case 0x19 : return 'mouse_up'; + case 0x1a : return 'mouse_wheel'; + case 0x1b : return 'object_created'; + case 0x1c : return 'object_initialized'; + case 0x1d : return 'pause'; + case 0x1e : return 'project_initialized'; + case 0x1f : return 'restart'; + case 0x20 : return 'slider_entity_initialized'; + case 0x21 : return 'start'; + case 0x22 : return 'touch_cancel'; + case 0x23 : return 'touch_end'; + case 0x24 : return 'touch_move'; + case 0x25 : return 'touch_start'; + case 0x26 : return 'update_from_instance_after'; + case 0x27 : return 'update_from_instance_before'; + case 0x28 : return 'update_instance_after'; + case 0x29 : return 'update_instance_before'; + case 0x2a : return 'update_instance_property'; + case 0x2b : return 'update_property_from_instance'; default : throw new Error('Event type not defined : ' + eventId); } diff --git a/src/r3/r3-project.js b/src/r3/r3-project.js index 95e0231..b986c81 100644 --- a/src/r3/r3-project.js +++ b/src/r3/r3-project.js @@ -166,6 +166,10 @@ class Project extends R3Object { this.createInstance(); } + if (this instanceof R3.Entity) { + this.start(); + } + } else { this.initializeDepth++; } diff --git a/src/r3/r3-r3.js b/src/r3/r3-r3.js index 1bce48e..223b4a4 100644 --- a/src/r3/r3-r3.js +++ b/src/r3/r3-r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.869'; - static compileDate = '2021 Sep 22 - 13:06:11 pm'; + static version = '2.0.877'; + static compileDate = '2021 Sep 22 - 13:55:35 pm'; } //GENERATED_IMPORTS_START diff --git a/src/templates/base_initialize_after.template b/src/templates/base_initialize_after.template new file mode 100644 index 0000000..fdd4fdb --- /dev/null +++ b/src/templates/base_initialize_after.template @@ -0,0 +1,5 @@ + if (this.initializeDepth === this.maxDepth) { + throw new Error('You should not try to instantiate this base class - extend it rather...'); + } else { + this.initializeDepth++; + } \ No newline at end of file diff --git a/src/templates/component_extends.template b/src/templates/component_extends.template index 7f2be27..81d66da 100644 --- a/src/templates/component_extends.template +++ b/src/templates/component_extends.template @@ -11,7 +11,6 @@ const EXTEND_CLASS = require('INCLUDE_PATH/EXTEND_CLASS_FILE_NAME'); TEMPLATE_OPTIONS_START initialized=false - A boolean which indicates whether or not this component has initialized instance=null - Holds the current instance of this object as determined (built) by the runtime object. - maxDepth=options.callDepth - Indicates the maximum call depth of this component initializeDepth=0 - The amount of times this component passed through initialize() functions TEMPLATE_OPTIONS_END diff --git a/src/templates/entity_base_constructor.template b/src/templates/entity_base_constructor.template index 16e87ad..79e8e15 100644 --- a/src/templates/entity_base_constructor.template +++ b/src/templates/entity_base_constructor.template @@ -1,18 +1,22 @@ constructor(options) { + super(options); + if (typeof options === 'undefined') { options = {}; } + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + if (typeof options.callDepth === 'undefined') { options.callDepth = 0; } else { options.callDepth++; } - super(options); - - this.emit(Event.ENTITY_CREATED, this); + options.maxDepth = options.callDepth; //GENERATED_TEMPLATE_OPTIONS_INIT_START //GENERATED_TEMPLATE_OPTIONS_INIT_END @@ -25,6 +29,8 @@ Object.assign(this, options); + this.emit(Event.ENTITY_CREATED, this); + //CUSTOM_BEFORE_INIT_START //CUSTOM_BEFORE_INIT_END diff --git a/src/templates/entity_extends.template b/src/templates/entity_extends.template index bf77d1a..be27089 100644 --- a/src/templates/entity_extends.template +++ b/src/templates/entity_extends.template @@ -9,6 +9,8 @@ const EXTEND_CLASS = require('INCLUDE_PATH/EXTEND_CLASS_FILE_NAME'); GENERATED_INHERITED_END TEMPLATE_OPTIONS_START + initialized=false - A boolean which indicates whether or not this entity has initialized + initializeDepth=0 - The amount of times this component passed through initialize() functions parent=null - The parent R3.Object of this component components=[] - A list of components that this entity is composed of started=false - Indicates whether or not this entity is active (subscribing to events) or not diff --git a/src/templates/entity_extends_constructor.template b/src/templates/entity_extends_constructor.template index 583df48..9b9289a 100644 --- a/src/templates/entity_extends_constructor.template +++ b/src/templates/entity_extends_constructor.template @@ -4,6 +4,10 @@ options = {}; } + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + if (typeof options.initialized === 'undefined') { options.initialized = false; } @@ -14,11 +18,13 @@ options.callDepth++; } - super(options); + options.maxDepth = options.callDepth; //GENERATED_TEMPLATE_OPTIONS_INIT_START //GENERATED_TEMPLATE_OPTIONS_INIT_END + super(options); + //GENERATED_OPTIONS_INIT_START //GENERATED_OPTIONS_INIT_END diff --git a/src/templates/start.template b/src/templates/start.template index fae4a85..8404af5 100644 --- a/src/templates/start.template +++ b/src/templates/start.template @@ -7,4 +7,11 @@ this.started = true; + if (this instanceof R3.Entity) { + this.emit( + Event.ENTITY_STARTED, + this + ); + } + console.log('Started transient system: CLASS_NAME'); \ No newline at end of file diff --git a/version b/version index 2f9c566..14b7e26 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.0.869 \ No newline at end of file +2.0.877 \ No newline at end of file