very cool - done with extends + normal class (for now)

master
Theunis J. Botha 2021-06-20 13:03:25 +02:00
parent 8778fa522c
commit fd5eba2cc6
17 changed files with 927 additions and 1595 deletions

View File

@ -3,3 +3,6 @@ r3 create AnotherClass extends R3Object
r3 create OneMore extends R3Object
r3 create AgainMore extends R3Object
r3 create AgainMoreAgain extends R3Object
r3 create Event normal
r3 create R3Object extends Event
r3 create SomeTest extends Event

View File

@ -1,156 +0,0 @@
#!/usr/bin/php
<?php
if (isset($argc)) {
for ($i = 0; $i < $argc; $i++) {
echo "Argument #" . $i . " - " . $argv[$i] . "\n";
}
}
else {
echo "argc and argv disabled\n";
}
if ($argv[1] == 'all') {
$files = scandir('src/r3', SCANDIR_SORT_DESCENDING);
$newFiles = [];
for ($i = 0; $i < sizeof($files); $i++) {
if (preg_match('/\.js$/', $files[$i])) {
array_push($newFiles, 'src/r3/' . $files[$i]);
}
}
$files = $newFiles;
} else {
$files = [$argv[1]];
}
foreach ($files as $file) {
echo $file . "\n";
echo "processing file " . $file . "\n";
$fn = fopen($file, "r");
$startCapture = false;
$saveLine = true;
$options = [];
$lines = [];
while (!feof($fn)) {
$line = fgets($fn);
if (
preg_match('/OPTIONS_END/', $line)
) {
$startCapture = false;
}
if (
preg_match('/OPTIONS_INIT_END/', $line)
) {
$saveLine = true;
}
if ($saveLine) {
array_push($lines, $line);
}
if (
preg_match('/OPTIONS_INIT_START/', $line)
) {
$saveLine = false;
}
if ($startCapture) {
$line = trim($line);
$key_value = preg_split('/=/', $line);
if ($key_value === false) {
continue;
}
$options[$key_value[0]] = $key_value[1];
}
if (
preg_match('/OPTIONS_START/', $line)
) {
$startCapture = true;
}
}
fclose($fn);
file_put_contents($file, $lines);
$template = file_get_contents('src/templates/options_init.template');
$newOptions = '';
foreach ($options as $key => $value) {
$updated = str_replace('KEY', $key, $template);
$updated = str_replace('VALUE', $value, $updated);
$newOptions .= $updated;
}
$contents = file_get_contents($file);
$contents = preg_replace(
'/\/\/OPTIONS_INIT_START.*?\/\/OPTIONS_INIT_END/s',
"//OPTIONS_INIT_START\n" . $newOptions . "\t\t//OPTIONS_INIT_END",
$contents
);
file_put_contents($file, $contents);
print_r($newOptions);
}
exit(0);
array_push($events, 'Event.START');
array_push($events, 'Event.PAUSE');
array_push($events, 'Event.RESTART');
sort($events);
$i = 1;
$eventList = '';
$eventFunction = "Event.GetEventName = function(eventId) {\n\n\tswitch(eventId) {\n";
foreach ($events as $event) {
$eventList .= $event . " = " . "0x" . dechex($i) . ";\n";
$eventFunction .= "\t\tcase 0x" . dechex($i). " : return '" . strtolower(str_replace('Event.', '', $event)) . "';\n";
$i++;
}
$eventList .= "Event.MAX_EVENTS = " . "0x" . dechex($i) . ";\n\n";
$eventFunction .= "\t\tdefault :\n\t\t\tthrow new Error('Event type not defined : ' + eventId);\n";
$eventFunction .= "\t}\n\n";
$eventFunction .= "};\n";
echo $eventList;
echo $eventFunction;
file_put_contents('./src/r3/events-generated', $eventList . $eventFunction);
?>

View File

@ -1,6 +1,6 @@
const R3Object = require('r3-r3-object.js');
const Event = require('r3-event');
const Utils = require('r3-utils');
const R3Object = require('r3-r3-object.js');
/**
@ -202,4 +202,9 @@ class AnotherClass extends R3Object {
//CUSTOM_IMPLEMENTATION_START
//CUSTOM_IMPLEMENTATION_END
}
}
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
module.exports = AnotherClass;

View File

@ -1,10 +1,156 @@
const Utils = require('./r3-utils');
const Event = require('r3-event');
const Utils = require('r3-utils');
/**
OPTIONS_START
OPTIONS_END
INSTANCE_OPTIONS_MAPPING_START
INSTANCE_OPTIONS_MAPPING_END
LINKED_OBJECTS_START
LINKED_OBJECTS_END
EXCLUDED_FROM_INSTANCE_OPTIONS_START
EXCLUDED_FROM_INSTANCE_OPTIONS_END
**/
class Event {
constructor(options) {
console.log('Event created');
}
//CONSTRUCTOR_TEMPLATE_START
constructor(options) {
if (Utils.UndefinedOrNull(options)) {
options = {};
}
options.id = Utils.RandomId(10);
options.name = 'Event (' + options.id + ')';
Event.Emit(Event.OBJECT_CREATED, this);
//OPTIONS_INIT_START
//OPTIONS_INIT_END
//CUSTOM_OPTIONS_INIT_START
//CUSTOM_OPTIONS_INIT_END
Object.assign(this, options);
//CUSTOM_BEFORE_INIT_START
//CUSTOM_BEFORE_INIT_END
Event.Emit(Event.OBJECT_INITIALIZED, this);
}
//CONSTRUCTOR_TEMPLATE_END
//CREATE_INSTANCE_TEMPLATE_START
createInstance() {
//CREATE_INSTANCE_BEFORE_START
super.createInstance();
this.emit(Event.CREATE_INSTANCE, this);
if (this.runtime === 'graphics') {
this.graphics.createInstance(
{
//CREATE_INSTANCE_OPTIONS_START
//CREATE_INSTANCE_OPTIONS_END
},
this
)
}
//CREATE_INSTANCE_BEFORE_END
//CUSTOM_CREATE_INSTANCE_START
//CUSTOM_CREATE_INSTANCE_END
//CREATE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_CREATED, this);
//CREATE_INSTANCE_AFTER_END
}
//CREATE_INSTANCE_TEMPLATE_END
//UPDATE_INSTANCE_TEMPLATE_START
updateInstance(property) {
//UPDATE_INSTANCE_BEFORE_START
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
//UPDATE_INSTANCE_BEFORE_END
//UPDATE_INSTANCE_OPTIONS_START
//UPDATE_INSTANCE_OPTIONS_END
//CUSTOM_UPDATE_INSTANCE_START
//CUSTOM_UPDATE_INSTANCE_END
//UPDATE_INSTANCE_AFTER_START
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
//UPDATE_INSTANCE_AFTER_END
}
//UPDATE_INSTANCE_TEMPLATE_END
//UPDATE_FROM_INSTANCE_TEMPLATE_START
updateFromInstance(property) {
//UPDATE_FROM_INSTANCE_BEFORE_START
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
//UPDATE_FROM_INSTANCE_BEFORE_END
//UPDATE_FROM_INSTANCE_OPTIONS_START
//UPDATE_FROM_INSTANCE_OPTIONS_END
//CUSTOM_UPDATE_FROM_INSTANCE_START
//CUSTOM_UPDATE_FROM_INSTANCE_END
//UPDATE_FROM_INSTANCE_AFTER_START
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
//UPDATE_FROM_INSTANCE_AFTER_END
}
//UPDATE_FROM_INSTANCE_TEMPLATE_END
//DISPOSE_TEMPLATE_START
dispose() {
//DISPOSE_BEFORE_START
this.emit(Event.DISPOSE_OBJECT, this);
//DISPOSE_BEFORE_END
//CUSTOM_DISPOSE_START
//CUSTOM_DISPOSE_END
//DISPOSE_AFTER_START
this.emit(Event.OBJECT_DISPOSED, this);
//DISPOSE_AFTER_END
}
//DISPOSE_TEMPLATE_END
//DISPOSE_INSTANCE_TEMPLATE_START
disposeInstance() {
//DISPOSE_INSTANCE_BEFORE_START
super.disposeInstance();
this.emit(Event.DISPOSE_INSTANCE, this);
//DISPOSE_INSTANCE_BEFORE_END
//CUSTOM_DISPOSE_INSTANCE_START
//CUSTOM_DISPOSE_INSTANCE_END
//DISPOSE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_DISPOSED, this);
//DISPOSE_INSTANCE_AFTER_END
}
//DISPOSE_INSTANCE_TEMPLATE_END
//CUSTOM_IMPLEMENTATION_START
/**
* Some nice Events handling
@ -164,9 +310,12 @@ class Event {
)
}
};
//CUSTOM_IMPLEMENTATION_END
}
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//EVENT_GENERATED_START
Event.CREATE_INSTANCE = 0x1;
Event.DISPOSE_INSTANCE = 0x2;
@ -214,4 +363,6 @@ Event.GetEventName = function(eventId) {
};
//EVENT_GENERATED_END
module.exports = Event;
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
module.exports = Event;

View File

@ -1,17 +1,163 @@
const Event = require('./r3-event');
const Utils = require('r3-utils');
const Event = require('r3-event.js');
/**
OPTIONS_START
OPTIONS_END
INSTANCE_OPTIONS_MAPPING_START
INSTANCE_OPTIONS_MAPPING_END
LINKED_OBJECTS_START
LINKED_OBJECTS_END
EXCLUDED_FROM_INSTANCE_OPTIONS_START
EXCLUDED_FROM_INSTANCE_OPTIONS_END
**/
class R3Object extends Event {
constructor(options) {
//CONSTRUCTOR_EXTENDS_TEMPLATE_START
constructor(options) {
super(options);
if (Utils.UndefinedOrNull(options)) {
options = {};
}
console.log('Object created');
options.id = Utils.RandomId(10);
options.name = 'R3Object (' + options.id + ')';
this.emit(Event.OBJECT_CREATED);
super(options);
}
this.emit(Event.OBJECT_CREATED, this);
//OPTIONS_INIT_START
//OPTIONS_INIT_END
//CUSTOM_OPTIONS_INIT_START
//CUSTOM_OPTIONS_INIT_END
Object.assign(this, options);
//CUSTOM_BEFORE_INIT_START
//CUSTOM_BEFORE_INIT_END
this.emit(Event.OBJECT_INITIALIZED, this);
}
//CONSTRUCTOR_EXTENDS_TEMPLATE_END
//CREATE_INSTANCE_TEMPLATE_START
createInstance() {
//CREATE_INSTANCE_BEFORE_START
super.createInstance();
this.emit(Event.CREATE_INSTANCE, this);
if (this.runtime === 'graphics') {
this.graphics.createInstance(
{
//CREATE_INSTANCE_OPTIONS_START
//CREATE_INSTANCE_OPTIONS_END
},
this
)
}
//CREATE_INSTANCE_BEFORE_END
//CUSTOM_CREATE_INSTANCE_START
//CUSTOM_CREATE_INSTANCE_END
//CREATE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_CREATED, this);
//CREATE_INSTANCE_AFTER_END
}
//CREATE_INSTANCE_TEMPLATE_END
//UPDATE_INSTANCE_TEMPLATE_START
updateInstance(property) {
//UPDATE_INSTANCE_BEFORE_START
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
//UPDATE_INSTANCE_BEFORE_END
//UPDATE_INSTANCE_OPTIONS_START
//UPDATE_INSTANCE_OPTIONS_END
//CUSTOM_UPDATE_INSTANCE_START
//CUSTOM_UPDATE_INSTANCE_END
//UPDATE_INSTANCE_AFTER_START
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
//UPDATE_INSTANCE_AFTER_END
}
//UPDATE_INSTANCE_TEMPLATE_END
//UPDATE_FROM_INSTANCE_TEMPLATE_START
updateFromInstance(property) {
//UPDATE_FROM_INSTANCE_BEFORE_START
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
//UPDATE_FROM_INSTANCE_BEFORE_END
//UPDATE_FROM_INSTANCE_OPTIONS_START
//UPDATE_FROM_INSTANCE_OPTIONS_END
//CUSTOM_UPDATE_FROM_INSTANCE_START
//CUSTOM_UPDATE_FROM_INSTANCE_END
//UPDATE_FROM_INSTANCE_AFTER_START
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
//UPDATE_FROM_INSTANCE_AFTER_END
}
//UPDATE_FROM_INSTANCE_TEMPLATE_END
//DISPOSE_TEMPLATE_START
dispose() {
//DISPOSE_BEFORE_START
this.emit(Event.DISPOSE_OBJECT, this);
//DISPOSE_BEFORE_END
//CUSTOM_DISPOSE_START
//CUSTOM_DISPOSE_END
//DISPOSE_AFTER_START
this.emit(Event.OBJECT_DISPOSED, this);
//DISPOSE_AFTER_END
}
//DISPOSE_TEMPLATE_END
//DISPOSE_INSTANCE_TEMPLATE_START
disposeInstance() {
//DISPOSE_INSTANCE_BEFORE_START
super.disposeInstance();
this.emit(Event.DISPOSE_INSTANCE, this);
//DISPOSE_INSTANCE_BEFORE_END
//CUSTOM_DISPOSE_INSTANCE_START
//CUSTOM_DISPOSE_INSTANCE_END
//DISPOSE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_DISPOSED, this);
//DISPOSE_INSTANCE_AFTER_END
}
//DISPOSE_INSTANCE_TEMPLATE_END
//CUSTOM_IMPLEMENTATION_START
//CUSTOM_IMPLEMENTATION_END
}
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
module.exports = R3Object;

View File

@ -1,6 +1,5 @@
const Event = require('r3-event.js');
const Event = require('r3-event');
const Utils = require('r3-utils');
const Event = require('r3-event.js');
/**
@ -186,4 +185,9 @@ class VectorApplierAgain extends Event {
//CUSTOM_IMPLEMENTATION_START
//CUSTOM_IMPLEMENTATION_END
}
}
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
module.exports = VectorApplierAgain;

2
dist/r3-node/r3.js vendored
View File

@ -7,7 +7,7 @@ class R3 {
}
static version() {
return 'Sun Jun 20 2021 06:12:04 GMT+0000 (Coordinated Universal Time)';
return 'Sun Jun 20 2021 11:02:42 GMT+0000 (Coordinated Universal Time)';
}
}

1541
dist/r3.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
const R3Object = require('r3-r3-object.js');
const Event = require('r3-event');
const Utils = require('r3-utils');
const R3Object = require('r3-r3-object.js');
/**
@ -202,4 +202,9 @@ class AnotherClass extends R3Object {
//CUSTOM_IMPLEMENTATION_START
//CUSTOM_IMPLEMENTATION_END
}
}
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
module.exports = AnotherClass;

60
src/r3/r3-event.bak.js Normal file
View File

@ -0,0 +1,60 @@
const Utils = require('./r3-utils');
class Event {
constructor(options) {
console.log('Event created');
}
}
//EVENT_GENERATED_START
Event.CREATE_INSTANCE = 0x1;
Event.DISPOSE_INSTANCE = 0x2;
Event.DISPOSE_OBJECT = 0x3;
Event.GET_RUNTIME = 0x4;
Event.GET_WINDOW_SIZE = 0x5;
Event.INSTANCE_CREATED = 0x6;
Event.INSTANCE_DISPOSED = 0x7;
Event.OBJECT_CREATED = 0x8;
Event.OBJECT_DISPOSED = 0x9;
Event.OBJECT_INITIALIZED = 0xa;
Event.PAUSE = 0xb;
Event.RESTART = 0xc;
Event.START = 0xd;
Event.UPDATE_FROM_INSTANCE_AFTER = 0xe;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0xf;
Event.UPDATE_INSTANCE_AFTER = 0x10;
Event.UPDATE_INSTANCE_BEFORE = 0x11;
Event.MAX_EVENTS = 0x12;
Event.GetEventName = function(eventId) {
switch(eventId) {
case 0x1 : return 'create_instance';
case 0x2 : return 'dispose_instance';
case 0x3 : return 'dispose_object';
case 0x4 : return 'get_runtime';
case 0x5 : return 'get_window_size';
case 0x6 : return 'instance_created';
case 0x7 : return 'instance_disposed';
case 0x8 : return 'object_created';
case 0x9 : return 'object_disposed';
case 0xa : return 'object_initialized';
case 0xb : return 'pause';
case 0xc : return 'restart';
case 0xd : return 'start';
case 0xe : return 'update_from_instance_after';
case 0xf : return 'update_from_instance_before';
case 0x10 : return 'update_instance_after';
case 0x11 : return 'update_instance_before';
default :
throw new Error('Event type not defined : ' + eventId);
}
};
//EVENT_GENERATED_END
module.exports = Event;

View File

@ -1,10 +1,156 @@
const Utils = require('./r3-utils');
const Event = require('r3-event');
const Utils = require('r3-utils');
/**
OPTIONS_START
OPTIONS_END
INSTANCE_OPTIONS_MAPPING_START
INSTANCE_OPTIONS_MAPPING_END
LINKED_OBJECTS_START
LINKED_OBJECTS_END
EXCLUDED_FROM_INSTANCE_OPTIONS_START
EXCLUDED_FROM_INSTANCE_OPTIONS_END
**/
class Event {
constructor(options) {
console.log('Event created');
}
//CONSTRUCTOR_TEMPLATE_START
constructor(options) {
if (Utils.UndefinedOrNull(options)) {
options = {};
}
options.id = Utils.RandomId(10);
options.name = 'Event (' + options.id + ')';
Event.Emit(Event.OBJECT_CREATED, this);
//OPTIONS_INIT_START
//OPTIONS_INIT_END
//CUSTOM_OPTIONS_INIT_START
//CUSTOM_OPTIONS_INIT_END
Object.assign(this, options);
//CUSTOM_BEFORE_INIT_START
//CUSTOM_BEFORE_INIT_END
Event.Emit(Event.OBJECT_INITIALIZED, this);
}
//CONSTRUCTOR_TEMPLATE_END
//CREATE_INSTANCE_TEMPLATE_START
createInstance() {
//CREATE_INSTANCE_BEFORE_START
super.createInstance();
this.emit(Event.CREATE_INSTANCE, this);
if (this.runtime === 'graphics') {
this.graphics.createInstance(
{
//CREATE_INSTANCE_OPTIONS_START
//CREATE_INSTANCE_OPTIONS_END
},
this
)
}
//CREATE_INSTANCE_BEFORE_END
//CUSTOM_CREATE_INSTANCE_START
//CUSTOM_CREATE_INSTANCE_END
//CREATE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_CREATED, this);
//CREATE_INSTANCE_AFTER_END
}
//CREATE_INSTANCE_TEMPLATE_END
//UPDATE_INSTANCE_TEMPLATE_START
updateInstance(property) {
//UPDATE_INSTANCE_BEFORE_START
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
//UPDATE_INSTANCE_BEFORE_END
//UPDATE_INSTANCE_OPTIONS_START
//UPDATE_INSTANCE_OPTIONS_END
//CUSTOM_UPDATE_INSTANCE_START
//CUSTOM_UPDATE_INSTANCE_END
//UPDATE_INSTANCE_AFTER_START
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
//UPDATE_INSTANCE_AFTER_END
}
//UPDATE_INSTANCE_TEMPLATE_END
//UPDATE_FROM_INSTANCE_TEMPLATE_START
updateFromInstance(property) {
//UPDATE_FROM_INSTANCE_BEFORE_START
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
//UPDATE_FROM_INSTANCE_BEFORE_END
//UPDATE_FROM_INSTANCE_OPTIONS_START
//UPDATE_FROM_INSTANCE_OPTIONS_END
//CUSTOM_UPDATE_FROM_INSTANCE_START
//CUSTOM_UPDATE_FROM_INSTANCE_END
//UPDATE_FROM_INSTANCE_AFTER_START
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
//UPDATE_FROM_INSTANCE_AFTER_END
}
//UPDATE_FROM_INSTANCE_TEMPLATE_END
//DISPOSE_TEMPLATE_START
dispose() {
//DISPOSE_BEFORE_START
this.emit(Event.DISPOSE_OBJECT, this);
//DISPOSE_BEFORE_END
//CUSTOM_DISPOSE_START
//CUSTOM_DISPOSE_END
//DISPOSE_AFTER_START
this.emit(Event.OBJECT_DISPOSED, this);
//DISPOSE_AFTER_END
}
//DISPOSE_TEMPLATE_END
//DISPOSE_INSTANCE_TEMPLATE_START
disposeInstance() {
//DISPOSE_INSTANCE_BEFORE_START
super.disposeInstance();
this.emit(Event.DISPOSE_INSTANCE, this);
//DISPOSE_INSTANCE_BEFORE_END
//CUSTOM_DISPOSE_INSTANCE_START
//CUSTOM_DISPOSE_INSTANCE_END
//DISPOSE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_DISPOSED, this);
//DISPOSE_INSTANCE_AFTER_END
}
//DISPOSE_INSTANCE_TEMPLATE_END
//CUSTOM_IMPLEMENTATION_START
/**
* Some nice Events handling
@ -164,9 +310,12 @@ class Event {
)
}
};
//CUSTOM_IMPLEMENTATION_END
}
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//EVENT_GENERATED_START
Event.CREATE_INSTANCE = 0x1;
Event.DISPOSE_INSTANCE = 0x2;
@ -214,4 +363,6 @@ Event.GetEventName = function(eventId) {
};
//EVENT_GENERATED_END
module.exports = Event;
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
module.exports = Event;

View File

@ -1,17 +1,163 @@
const Event = require('./r3-event');
const Utils = require('r3-utils');
const Event = require('r3-event.js');
/**
OPTIONS_START
OPTIONS_END
INSTANCE_OPTIONS_MAPPING_START
INSTANCE_OPTIONS_MAPPING_END
LINKED_OBJECTS_START
LINKED_OBJECTS_END
EXCLUDED_FROM_INSTANCE_OPTIONS_START
EXCLUDED_FROM_INSTANCE_OPTIONS_END
**/
class R3Object extends Event {
constructor(options) {
//CONSTRUCTOR_EXTENDS_TEMPLATE_START
constructor(options) {
super(options);
if (Utils.UndefinedOrNull(options)) {
options = {};
}
console.log('Object created');
options.id = Utils.RandomId(10);
options.name = 'R3Object (' + options.id + ')';
this.emit(Event.OBJECT_CREATED);
super(options);
}
this.emit(Event.OBJECT_CREATED, this);
//OPTIONS_INIT_START
//OPTIONS_INIT_END
//CUSTOM_OPTIONS_INIT_START
//CUSTOM_OPTIONS_INIT_END
Object.assign(this, options);
//CUSTOM_BEFORE_INIT_START
//CUSTOM_BEFORE_INIT_END
this.emit(Event.OBJECT_INITIALIZED, this);
}
//CONSTRUCTOR_EXTENDS_TEMPLATE_END
//CREATE_INSTANCE_TEMPLATE_START
createInstance() {
//CREATE_INSTANCE_BEFORE_START
super.createInstance();
this.emit(Event.CREATE_INSTANCE, this);
if (this.runtime === 'graphics') {
this.graphics.createInstance(
{
//CREATE_INSTANCE_OPTIONS_START
//CREATE_INSTANCE_OPTIONS_END
},
this
)
}
//CREATE_INSTANCE_BEFORE_END
//CUSTOM_CREATE_INSTANCE_START
//CUSTOM_CREATE_INSTANCE_END
//CREATE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_CREATED, this);
//CREATE_INSTANCE_AFTER_END
}
//CREATE_INSTANCE_TEMPLATE_END
//UPDATE_INSTANCE_TEMPLATE_START
updateInstance(property) {
//UPDATE_INSTANCE_BEFORE_START
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
//UPDATE_INSTANCE_BEFORE_END
//UPDATE_INSTANCE_OPTIONS_START
//UPDATE_INSTANCE_OPTIONS_END
//CUSTOM_UPDATE_INSTANCE_START
//CUSTOM_UPDATE_INSTANCE_END
//UPDATE_INSTANCE_AFTER_START
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
//UPDATE_INSTANCE_AFTER_END
}
//UPDATE_INSTANCE_TEMPLATE_END
//UPDATE_FROM_INSTANCE_TEMPLATE_START
updateFromInstance(property) {
//UPDATE_FROM_INSTANCE_BEFORE_START
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
//UPDATE_FROM_INSTANCE_BEFORE_END
//UPDATE_FROM_INSTANCE_OPTIONS_START
//UPDATE_FROM_INSTANCE_OPTIONS_END
//CUSTOM_UPDATE_FROM_INSTANCE_START
//CUSTOM_UPDATE_FROM_INSTANCE_END
//UPDATE_FROM_INSTANCE_AFTER_START
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
//UPDATE_FROM_INSTANCE_AFTER_END
}
//UPDATE_FROM_INSTANCE_TEMPLATE_END
//DISPOSE_TEMPLATE_START
dispose() {
//DISPOSE_BEFORE_START
this.emit(Event.DISPOSE_OBJECT, this);
//DISPOSE_BEFORE_END
//CUSTOM_DISPOSE_START
//CUSTOM_DISPOSE_END
//DISPOSE_AFTER_START
this.emit(Event.OBJECT_DISPOSED, this);
//DISPOSE_AFTER_END
}
//DISPOSE_TEMPLATE_END
//DISPOSE_INSTANCE_TEMPLATE_START
disposeInstance() {
//DISPOSE_INSTANCE_BEFORE_START
super.disposeInstance();
this.emit(Event.DISPOSE_INSTANCE, this);
//DISPOSE_INSTANCE_BEFORE_END
//CUSTOM_DISPOSE_INSTANCE_START
//CUSTOM_DISPOSE_INSTANCE_END
//DISPOSE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_DISPOSED, this);
//DISPOSE_INSTANCE_AFTER_END
}
//DISPOSE_INSTANCE_TEMPLATE_END
//CUSTOM_IMPLEMENTATION_START
//CUSTOM_IMPLEMENTATION_END
}
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
module.exports = R3Object;

View File

@ -1,6 +1,5 @@
const Event = require('r3-event.js');
const Event = require('r3-event');
const Utils = require('r3-utils');
const Event = require('r3-event.js');
/**
@ -186,4 +185,9 @@ class VectorApplierAgain extends Event {
//CUSTOM_IMPLEMENTATION_START
//CUSTOM_IMPLEMENTATION_END
}
}
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
module.exports = VectorApplierAgain;

View File

@ -0,0 +1,24 @@
constructor(options) {
if (Utils.UndefinedOrNull(options)) {
options = {};
}
options.id = Utils.RandomId(10);
options.name = 'CLASS_NAME (' + options.id + ')';
Event.Emit(Event.OBJECT_CREATED, this);
//OPTIONS_INIT_START
//OPTIONS_INIT_END
//CUSTOM_OPTIONS_INIT_START
//CUSTOM_OPTIONS_INIT_END
Object.assign(this, options);
//CUSTOM_BEFORE_INIT_START
//CUSTOM_BEFORE_INIT_END
Event.Emit(Event.OBJECT_INITIALIZED, this);
}

View File

@ -1,6 +1,6 @@
const EXTEND_CLASS = require('EXTEND_CLASS_FILE_NAME');
const Event = require('r3-event');
const Utils = require('r3-utils');
const EXTEND_CLASS = require('EXTEND_CLASS_FILE_NAME');
/**
@ -41,4 +41,9 @@ class CLASS_NAME extends EXTEND_CLASS {
//CUSTOM_IMPLEMENTATION_START
//CUSTOM_IMPLEMENTATION_END
}
}
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
module.exports = CLASS_NAME;

View File

@ -0,0 +1,48 @@
const Event = require('r3-event');
const Utils = require('r3-utils');
/**
OPTIONS_START
OPTIONS_END
INSTANCE_OPTIONS_MAPPING_START
INSTANCE_OPTIONS_MAPPING_END
LINKED_OBJECTS_START
LINKED_OBJECTS_END
EXCLUDED_FROM_INSTANCE_OPTIONS_START
EXCLUDED_FROM_INSTANCE_OPTIONS_END
**/
class CLASS_NAME {
//CONSTRUCTOR_TEMPLATE_START
//CONSTRUCTOR_TEMPLATE_END
//CREATE_INSTANCE_TEMPLATE_START
//CREATE_INSTANCE_TEMPLATE_END
//UPDATE_INSTANCE_TEMPLATE_START
//UPDATE_INSTANCE_TEMPLATE_END
//UPDATE_FROM_INSTANCE_TEMPLATE_START
//UPDATE_FROM_INSTANCE_TEMPLATE_END
//DISPOSE_TEMPLATE_START
//DISPOSE_TEMPLATE_END
//DISPOSE_INSTANCE_TEMPLATE_START
//DISPOSE_INSTANCE_TEMPLATE_END
//CUSTOM_IMPLEMENTATION_START
//CUSTOM_IMPLEMENTATION_END
}
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
module.exports = CLASS_NAME;

View File

@ -22,7 +22,8 @@ $tokens = [
'CUSTOM_UPDATE_FROM_INSTANCE_START' => 'CUSTOM_UPDATE_FROM_INSTANCE_END',
'CUSTOM_DISPOSE_START' => 'CUSTOM_DISPOSE_END',
'CUSTOM_DISPOSE_INSTANCE_START' => 'CUSTOM_DISPOSE_INSTANCE_END',
'CUSTOM_IMPLEMENTATION_START' => 'CUSTOM_IMPLEMENTATION_END'
'CUSTOM_IMPLEMENTATION_START' => 'CUSTOM_IMPLEMENTATION_END',
'CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START' => 'CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END'
];
$files = [$argv[2]];