dbm 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/CallFunction.js +21 -0
- package/commands/CommandBaseObject.js +11 -0
- package/commands/ResolvePromise.js +20 -0
- package/commands/index.js +36 -0
- package/core/BaseObject.js +23 -0
- package/core/GlobalObject.js +18 -0
- package/core/LifeCycleObject.js +25 -0
- package/core/index.js +3 -0
- package/dbm.js +71 -0
- package/flow/DirtyCommands.js +45 -0
- package/flow/FlowBaseObject.js +78 -0
- package/flow/FlowProperty.js +146 -0
- package/flow/FlowUpdateFunction.js +39 -0
- package/flow/UpdateFunctionInputs.js +58 -0
- package/flow/UpdateFunctionOutputs.js +51 -0
- package/flow/index.js +40 -0
- package/flow/updatefunctions/basic/CombineString.js +45 -0
- package/flow/updatefunctions/basic/RunCommand.js +34 -0
- package/flow/updatefunctions/basic/index.js +2 -0
- package/flow/updatefunctions/debug/Log.js +30 -0
- package/flow/updatefunctions/debug/index.js +1 -0
- package/flow/updatefunctions/dom/ElementSize.js +47 -0
- package/flow/updatefunctions/dom/StyleObject.js +43 -0
- package/flow/updatefunctions/dom/index.js +2 -0
- package/flow/updatefunctions/index.js +5 -0
- package/flow/updatefunctions/logic/Addition.js +19 -0
- package/flow/updatefunctions/logic/Multiplication.js +19 -0
- package/flow/updatefunctions/logic/RangeSwitch.js +46 -0
- package/flow/updatefunctions/logic/Subtraction.js +19 -0
- package/flow/updatefunctions/logic/index.js +38 -0
- package/flow/updatefunctions/react/UpdateState.js +22 -0
- package/flow/updatefunctions/react/index.js +1 -0
- package/graphapi/index.js +1 -0
- package/graphapi/webclient/WebSocketConnection.js +236 -0
- package/graphapi/webclient/WebSocketRequest.js +30 -0
- package/graphapi/webclient/decode/DecodeBaseObject.js +48 -0
- package/graphapi/webclient/decode/index.js +59 -0
- package/graphapi/webclient/index.js +4 -0
- package/index.js +1 -0
- package/loading/JsonLoader.js +128 -0
- package/loading/LoadingStatus.js +4 -0
- package/loading/ScriptLoader.js +40 -0
- package/loading/index.js +24 -0
- package/package.json +17 -0
- package/react/BaseObject.js +179 -0
- package/react/RefToProperty.js +20 -0
- package/react/admin/Editor.js +153 -0
- package/react/admin/EditorBlock.js +53 -0
- package/react/admin/EditorBlockName.js +19 -0
- package/react/admin/index.js +3 -0
- package/react/area/HasData.js +22 -0
- package/react/area/InsertElement.js +22 -0
- package/react/area/index.js +2 -0
- package/react/blocks/index.js +61 -0
- package/react/context/AddContextVariables.js +22 -0
- package/react/context/Context.js +4 -0
- package/react/context/index.js +2 -0
- package/react/cookies/CookieBar.js +162 -0
- package/react/cookies/CookieSettings.js +118 -0
- package/react/cookies/index.js +2 -0
- package/react/form/Checkbox.js +28 -0
- package/react/form/FormField.js +28 -0
- package/react/form/index.js +2 -0
- package/react/index.js +13 -0
- package/react/login/LoginForm.js +113 -0
- package/react/login/index.js +1 -0
- package/react/modules/ModuleCreator.js +30 -0
- package/react/modules/index.js +1 -0
- package/react/source/ContextVariableSource.js +19 -0
- package/react/source/index.js +1 -0
- package/react/text/HtmlText.js +14 -0
- package/react/text/Text.js +13 -0
- package/react/text/index.js +19 -0
- package/repository/Item.js +70 -0
- package/repository/Repository.js +60 -0
- package/repository/index.js +2 -0
- package/site/SiteDataLoader.js +62 -0
- package/site/SiteNavigation.js +242 -0
- package/site/index.js +2 -0
- package/startup/Controller.js +43 -0
- package/startup/Runner.js +40 -0
- package/startup/index.js +28 -0
- package/tracking/Controller.js +157 -0
- package/tracking/DataLayerTracker.js +80 -0
- package/tracking/index.js +16 -0
- package/updater/PropertyUpdater.js +127 -0
- package/updater/RequestAnimationFrameTimer.js +43 -0
- package/updater/index.js +16 -0
- package/utils/ArrayFunctions.js +20 -0
- package/utils/index.js +1 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import Dbm from "../index.js";
|
|
2
|
+
import Runner from "./Runner.js";
|
|
3
|
+
|
|
4
|
+
export default class Controller extends Dbm.core.BaseObject {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
this._runners = [];
|
|
8
|
+
this._nextId = 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
get isSetup() {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
_getNextId() {
|
|
16
|
+
let nextId = this._nextId;
|
|
17
|
+
|
|
18
|
+
this._nextId++;
|
|
19
|
+
|
|
20
|
+
return nextId;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
create(aElement, aModuleName, aData) {
|
|
24
|
+
console.log("Controller::create");
|
|
25
|
+
console.log(aElement, aData);
|
|
26
|
+
|
|
27
|
+
let newRunner = new Runner();
|
|
28
|
+
newRunner.setup(aElement, aModuleName, aData, this._getNextId());
|
|
29
|
+
this.add(newRunner);
|
|
30
|
+
newRunner.start();
|
|
31
|
+
|
|
32
|
+
return newRunner;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
add(aWidget) {
|
|
36
|
+
this._runners.push(aWidget);
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
remove(aId) {
|
|
41
|
+
//METODO
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Dbm from "../index.js";
|
|
2
|
+
|
|
3
|
+
export default class Runner extends Dbm.core.BaseObject {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
|
|
7
|
+
this._element = null;
|
|
8
|
+
this._moduleName = null;
|
|
9
|
+
this._data = null;
|
|
10
|
+
this._id = -1;
|
|
11
|
+
this._reactRoot = null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
setup(aElement, aModuleName, aData, aId) {
|
|
15
|
+
this._element = aElement;
|
|
16
|
+
this._moduleName = aModuleName;
|
|
17
|
+
this._data = aData;
|
|
18
|
+
this._id = aId;
|
|
19
|
+
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
start() {
|
|
24
|
+
//console.log("Runner::start");
|
|
25
|
+
//console.log(this);
|
|
26
|
+
|
|
27
|
+
let root = document.createElement("div");
|
|
28
|
+
this._element.appendChild(root);
|
|
29
|
+
|
|
30
|
+
let module = Dbm.getInstance().repository.getItem("moduleCreators/" + this._moduleName).controller;
|
|
31
|
+
|
|
32
|
+
this._reactRoot = module.createModule(root, this._data);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
stop() {
|
|
36
|
+
//console.log("Runner::stop");
|
|
37
|
+
|
|
38
|
+
this._reactRoot.unmount();
|
|
39
|
+
}
|
|
40
|
+
}
|
package/startup/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Dbm from "../index.js";
|
|
2
|
+
|
|
3
|
+
export {default as Runner} from "./Runner.js";
|
|
4
|
+
export {default as Controller} from "./Controller.js";
|
|
5
|
+
|
|
6
|
+
export let runStartup = function() {
|
|
7
|
+
if(!window.dbmstartup.modules.isSetup) {
|
|
8
|
+
let controller = new Dbm.startup.Controller();
|
|
9
|
+
|
|
10
|
+
let currentArray = globalThis.dbmstartup.modules._;
|
|
11
|
+
|
|
12
|
+
globalThis.dbmstartup.modules = controller;
|
|
13
|
+
|
|
14
|
+
let currentArrayLength = currentArray.length;
|
|
15
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
16
|
+
let currentData = currentArray[i];
|
|
17
|
+
if(currentData) {
|
|
18
|
+
let newRunner = new Dbm.startup.Runner();
|
|
19
|
+
newRunner.setup(currentData["element"], currentData["moduleName"], currentData["data"], i);
|
|
20
|
+
newRunner.start();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
controller._nextId = currentArrayLength+1;
|
|
25
|
+
|
|
26
|
+
currentArray.splice(0, currentArrayLength);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import Dbm from "../index.js";
|
|
2
|
+
import Cookies from "js-cookie";
|
|
3
|
+
|
|
4
|
+
export default class Controller extends Dbm.core.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this.item.setValue("trackers", []);
|
|
9
|
+
|
|
10
|
+
Dbm.flow.addDirectUpdateCommand(this.item.requireProperty("active", false), Dbm.commands.callFunction(this._updateActiveStatus.bind(this)));
|
|
11
|
+
|
|
12
|
+
Dbm.flow.addDirectUpdateCommand(this.item.requireProperty("allowStatistics", false), Dbm.commands.callFunction(this._updateStatisticsTracking.bind(this)));
|
|
13
|
+
Dbm.flow.addDirectUpdateCommand(this.item.requireProperty("allowMarketing", false), Dbm.commands.callFunction(this._updateMarketingTracking.bind(this)));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
addTracker(aItem) {
|
|
17
|
+
//aItem.propertyInput("allowMarketing", this.item.getProperty("allowMarketing"));
|
|
18
|
+
//aItem.propertyInput("allowStatistics", this.item.getProperty("allowStatistics"));
|
|
19
|
+
|
|
20
|
+
let trackers = [].concat(this.item.trackers);
|
|
21
|
+
|
|
22
|
+
trackers.push(aItem);
|
|
23
|
+
|
|
24
|
+
this.item.trackers = trackers;
|
|
25
|
+
|
|
26
|
+
if(this.item.active) {
|
|
27
|
+
aItem.controller.startTracking();
|
|
28
|
+
if(this.item.allowStatistics) {
|
|
29
|
+
aItem.controller.startStatisticsTracking();
|
|
30
|
+
}
|
|
31
|
+
if(this.item.allowMarketing) {
|
|
32
|
+
aItem.controller.startMarketingTracking();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
setupPermissionsFromCookies() {
|
|
40
|
+
this.item.allowStatistics = Cookies.get("cookie/allowStatistics") === "1";
|
|
41
|
+
this.item.allowMarketing = Cookies.get("cookie/allowMarketing") === "1";
|
|
42
|
+
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
start() {
|
|
47
|
+
console.log("start");
|
|
48
|
+
this.item.active = true;
|
|
49
|
+
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
stop() {
|
|
54
|
+
this.item.active = false;
|
|
55
|
+
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
_updateActiveStatus() {
|
|
60
|
+
//console.log("_updateActiveStatus");
|
|
61
|
+
//console.log(this.item.active);
|
|
62
|
+
|
|
63
|
+
let allowStatistics = this.item.allowStatistics;
|
|
64
|
+
let allowMarketing = this.item.allowMarketing;
|
|
65
|
+
|
|
66
|
+
let currentArray = this.item.trackers;
|
|
67
|
+
let currentArrayLength = currentArray.length;
|
|
68
|
+
if(this.item.active) {
|
|
69
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
70
|
+
let currentTracker = currentArray[i];
|
|
71
|
+
currentTracker.controller.startTracking();
|
|
72
|
+
if(allowStatistics) {
|
|
73
|
+
currentTracker.controller.startStatisticsTracking();
|
|
74
|
+
currentTracker.controller.trackCurrentPage();
|
|
75
|
+
}
|
|
76
|
+
if(allowMarketing) {
|
|
77
|
+
currentTracker.controller.startMarketingTracking();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
83
|
+
currentArray[i].controller.stopTracking();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
_updateStatisticsTracking() {
|
|
89
|
+
//console.log("_updateStatisticsTracking");
|
|
90
|
+
//console.log(this.item.allowStatistics);
|
|
91
|
+
|
|
92
|
+
if(this.item.active && this.item.allowStatistics) {
|
|
93
|
+
let currentArray = this.item.trackers;
|
|
94
|
+
let currentArrayLength = currentArray.length;
|
|
95
|
+
|
|
96
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
97
|
+
let currentTracker = currentArray[i];
|
|
98
|
+
currentTracker.controller.startStatisticsTracking();
|
|
99
|
+
currentTracker.controller.trackCurrentPage();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
_updateMarketingTracking() {
|
|
105
|
+
//console.log("_updateMarketingTracking");
|
|
106
|
+
//console.log(this.item.allowMarketing);
|
|
107
|
+
|
|
108
|
+
if(this.item.active && this.item.allowMarketing) {
|
|
109
|
+
let currentArray = this.item.trackers;
|
|
110
|
+
let currentArrayLength = currentArray.length;
|
|
111
|
+
|
|
112
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
113
|
+
let currentTracker = currentArray[i];
|
|
114
|
+
currentTracker.controller.startMarketingTracking();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
trackEvent(aEventName, aData) {
|
|
120
|
+
console.log("trackEvent");
|
|
121
|
+
console.log(aEventName, aData);
|
|
122
|
+
|
|
123
|
+
if(this.item.active) {
|
|
124
|
+
let currentArray = this.item.trackers;
|
|
125
|
+
let currentArrayLength = currentArray.length;
|
|
126
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
127
|
+
currentArray[i].controller.trackEvent(aEventName, aData);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return this;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
trackPage(aUrl) {
|
|
135
|
+
if(this.item.active && this.item.allowStatistics) {
|
|
136
|
+
let currentArray = this.item.trackers;
|
|
137
|
+
let currentArrayLength = currentArray.length;
|
|
138
|
+
|
|
139
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
140
|
+
let currentTracker = currentArray[i];
|
|
141
|
+
currentTracker.controller.trackPage(aUrl);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
trackCurrentPage() {
|
|
147
|
+
if(this.item.active && this.item.allowStatistics) {
|
|
148
|
+
let currentArray = this.item.trackers;
|
|
149
|
+
let currentArrayLength = currentArray.length;
|
|
150
|
+
|
|
151
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
152
|
+
let currentTracker = currentArray[i];
|
|
153
|
+
currentTracker.controller.trackCurrentPage();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import Dbm from "../index.js";
|
|
2
|
+
import Cookies from "js-cookie";
|
|
3
|
+
|
|
4
|
+
export default class Controller extends Dbm.core.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
addToDataLayer(aData) {
|
|
10
|
+
|
|
11
|
+
window.dataLayer.push(aData);
|
|
12
|
+
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
_gtag() {
|
|
17
|
+
window.dataLayer.push(arguments);
|
|
18
|
+
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
startTracking() {
|
|
23
|
+
if(!window.dataLayer) {
|
|
24
|
+
window.dataLayer = [];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
this._gtag("consent", "default", {
|
|
28
|
+
"ad_storage": "denied",
|
|
29
|
+
"ad_user_data": "denied",
|
|
30
|
+
"ad_personalization": "denied",
|
|
31
|
+
"analytics_storage": "denied"
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
startStatisticsTracking() {
|
|
38
|
+
|
|
39
|
+
this._gtag("consent", "update", {
|
|
40
|
+
"analytics_storage": "granted"
|
|
41
|
+
});
|
|
42
|
+
this.addToDataLayer({"event": "enableStatistics"});
|
|
43
|
+
this.addToDataLayer({"event": "trackCurrentPage"});
|
|
44
|
+
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
startMarketingTracking() {
|
|
49
|
+
|
|
50
|
+
this._gtag("consent", "update", {
|
|
51
|
+
"ad_storage": "granted",
|
|
52
|
+
"ad_user_data": "granted",
|
|
53
|
+
"ad_personalization": "granted"
|
|
54
|
+
});
|
|
55
|
+
this.addToDataLayer({"event": "enableMarketing"});
|
|
56
|
+
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
stopTracking() {
|
|
61
|
+
this.addToDataLayer({"event": "stopTracking"});
|
|
62
|
+
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
trackEvent(aEventName, aData) {
|
|
67
|
+
console.log("trackEvent");
|
|
68
|
+
console.log(aEventName, aData);
|
|
69
|
+
|
|
70
|
+
this.addToDataLayer({"event": "trackEvent", "value": {"name": aEventName, "data": aData}});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
trackCurrentPage() {
|
|
74
|
+
this.trackPage(document.location.href);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
trackPage(aUrl) {
|
|
78
|
+
this.addToDataLayer({"event": "trackPage", "value": {"url": aUrl}});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Dbm from "../index.js";
|
|
2
|
+
|
|
3
|
+
export {default as Controller} from "./Controller.js";
|
|
4
|
+
export {default as DataLayerTracker} from "./DataLayerTracker.js";
|
|
5
|
+
|
|
6
|
+
export let setup = function() {
|
|
7
|
+
|
|
8
|
+
let controller = new Dbm.tracking.Controller();
|
|
9
|
+
controller.item.register("trackingController");
|
|
10
|
+
|
|
11
|
+
controller.setupPermissionsFromCookies();
|
|
12
|
+
controller.start();
|
|
13
|
+
|
|
14
|
+
let dataLayerTracker = new Dbm.tracking.DataLayerTracker();
|
|
15
|
+
controller.addTracker(dataLayerTracker.item);
|
|
16
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import Dbm from "../index.js";
|
|
2
|
+
import {Tween, Easing} from '@tweenjs/tween.js';
|
|
3
|
+
|
|
4
|
+
export default class PropertyUpdater extends Dbm.core.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this.item.setValue("tweens", []);
|
|
9
|
+
this.item.setValue("updatedProperties", []);
|
|
10
|
+
this.item.setValue("singleUpdateProperties", []);
|
|
11
|
+
this.item.setValue("running", false);
|
|
12
|
+
this.item.setValue("timer", 0);
|
|
13
|
+
|
|
14
|
+
this._updateBound = this._update.bind(this);
|
|
15
|
+
this.addSinglePropertyUpdateBound = this.addSinglePropertyUpdate.bind(this);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
setTimer(aTimerItem) {
|
|
19
|
+
aTimerItem.update = this._updateBound;
|
|
20
|
+
this.item.timer = aTimerItem;
|
|
21
|
+
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_update(aTime) {
|
|
26
|
+
//console.log("_update");
|
|
27
|
+
{
|
|
28
|
+
let currentArray = this.item.tweens;
|
|
29
|
+
let currentArrayLength = currentArray.length;
|
|
30
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
31
|
+
let currentTween = currentArray[i];
|
|
32
|
+
currentTween.update();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
{
|
|
36
|
+
let currentArray = this.item.updatedProperties;
|
|
37
|
+
let currentArrayLength = currentArray.length;
|
|
38
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
39
|
+
let currentProperty = currentArray[i];
|
|
40
|
+
if(currentProperty.isDirty) {
|
|
41
|
+
//console.log(currentProperty);
|
|
42
|
+
currentProperty.updateFlow();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
{
|
|
48
|
+
let currentArray = this.item.singleUpdateProperties;
|
|
49
|
+
let currentArrayLength = currentArray.length;
|
|
50
|
+
if(currentArrayLength) {
|
|
51
|
+
this.item.singleUpdateProperties = [];
|
|
52
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
53
|
+
let currentProperty = currentArray[i];
|
|
54
|
+
if(currentProperty.isDirty) {
|
|
55
|
+
currentProperty.updateFlow();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
start() {
|
|
64
|
+
this.item.timer.controller.start();
|
|
65
|
+
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
stop() {
|
|
70
|
+
this.item.timer.controller.start();
|
|
71
|
+
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
addProperty(aProperty) {
|
|
76
|
+
|
|
77
|
+
let updatedProperties = [].concat(this.item.updatedProperties);
|
|
78
|
+
updatedProperties.push(aProperty);
|
|
79
|
+
this.item.updatedProperties = updatedProperties;
|
|
80
|
+
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
removeProperty(aProperty) {
|
|
85
|
+
|
|
86
|
+
let updatedProperties = [].concat(this.item.updatedProperties);
|
|
87
|
+
let index = updatedProperties.indexOf(aProperty);
|
|
88
|
+
|
|
89
|
+
if(index >= 0) {
|
|
90
|
+
updatedProperties.splice(index, 1);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
this.item.updatedProperties = updatedProperties;
|
|
94
|
+
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
animateProperty(aProperty, aToValue, aTime, aDelay = 0, aEasing = null) {
|
|
99
|
+
let tweenObject = {"envelope": aProperty.value};
|
|
100
|
+
if(!aEasing) {
|
|
101
|
+
aEasing = Easing.Quadratic.Out;
|
|
102
|
+
}
|
|
103
|
+
let tween = new Tween(tweenObject).to({"envelope": aToValue}, 1000*aTime).delay(1000*aDelay).easing(aEasing).onUpdate(function(aData) {aProperty.value = aData.envelope}).onComplete(() => {this.removeTween(tween)}).start();
|
|
104
|
+
|
|
105
|
+
let tweens = [].concat(this.item.tweens);
|
|
106
|
+
tweens.push(tween);
|
|
107
|
+
this.item.tweens = tweens;
|
|
108
|
+
|
|
109
|
+
return this;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
removeTween(aTween) {
|
|
113
|
+
//console.log("removeTween");
|
|
114
|
+
//METODO
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
addSinglePropertyUpdate(aProperty) {
|
|
118
|
+
//console.log("addSinglePropertyUpdate");
|
|
119
|
+
//console.log(aProperty);
|
|
120
|
+
|
|
121
|
+
let updatedProperties = [].concat(this.item.singleUpdateProperties);
|
|
122
|
+
updatedProperties.push(aProperty);
|
|
123
|
+
this.item.singleUpdateProperties = updatedProperties;
|
|
124
|
+
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import Dbm from "../index.js";
|
|
2
|
+
|
|
3
|
+
export default class RequestAnimationFrameTimer extends Dbm.core.BaseObject {
|
|
4
|
+
_construct() {
|
|
5
|
+
super._construct();
|
|
6
|
+
|
|
7
|
+
this.item.setValue("running", false);
|
|
8
|
+
this._requestId = 0;
|
|
9
|
+
this.item.setValue("update", function() {});
|
|
10
|
+
|
|
11
|
+
this._updateBound = this._update.bind(this);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
_update(aTime) {
|
|
15
|
+
|
|
16
|
+
this.item.update(aTime);
|
|
17
|
+
|
|
18
|
+
if(this.item.running) {
|
|
19
|
+
this.item.requestId = window.requestAnimationFrame(this._updateBound);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
start() {
|
|
24
|
+
if(!this.item.running) {
|
|
25
|
+
this.item.running = true;
|
|
26
|
+
this._requestId = window.requestAnimationFrame(this._updateBound);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
stop() {
|
|
33
|
+
if(this.item.running) {
|
|
34
|
+
this.item.running = false;
|
|
35
|
+
if(this._requestId) {
|
|
36
|
+
window.cancelAnimationFrame(this._requestId);
|
|
37
|
+
this._requestId = 0;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
}
|
package/updater/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Dbm from "../index.js";
|
|
2
|
+
|
|
3
|
+
export {default as PropertyUpdater} from "./PropertyUpdater.js";
|
|
4
|
+
export {default as RequestAnimationFrameTimer} from "./RequestAnimationFrameTimer.js";
|
|
5
|
+
|
|
6
|
+
let webSetup = function() {
|
|
7
|
+
let updater = new Dbm.updater.PropertyUpdater();
|
|
8
|
+
updater.item.register("propertyUpdater");
|
|
9
|
+
|
|
10
|
+
let requestAnimationFrameTimer = new Dbm.updater.RequestAnimationFrameTimer();
|
|
11
|
+
updater.setTimer(requestAnimationFrameTimer.item);
|
|
12
|
+
|
|
13
|
+
updater.start();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {webSetup};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
let range = function(aStartValue, aEndValue, aStep = 1) {
|
|
3
|
+
let returnArray = [];
|
|
4
|
+
|
|
5
|
+
return returnArray;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export {range};
|
|
9
|
+
|
|
10
|
+
let removeDuplicates = function(aArray) {
|
|
11
|
+
return aArray;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {removeDuplicates};
|
|
15
|
+
|
|
16
|
+
let removeDuplicates2 = function(aArray) {
|
|
17
|
+
return aArray;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {removeDuplicates2};
|
package/utils/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as ArrayFunctions from "./ArrayFunctions.js";
|