Skip to content

Commit 390ca6d

Browse files
committed
minor refactoring
1 parent 06a304d commit 390ca6d

File tree

3 files changed

+95
-146
lines changed

3 files changed

+95
-146
lines changed

src/component.js

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ function _Array(conf) {
148148

149149
length = del.length;
150150
for (i = 0; i < length; i++) {
151-
$workflow.state({
151+
$workflow.process({
152152
component: id,
153153
state: propertyName,
154154
data: [store[del[i]], 'remove']
@@ -171,7 +171,7 @@ function _Array(conf) {
171171
});
172172
}
173173

174-
$workflow.state({
174+
$workflow.process({
175175
component: id,
176176
state: propertyName,
177177
data: [val, 'add']
@@ -211,7 +211,7 @@ function _Array(conf) {
211211
});
212212
}
213213

214-
$workflow.state({
214+
$workflow.process({
215215
component: id,
216216
state: propertyName,
217217
data: [val, 'add']
@@ -267,7 +267,7 @@ function _Array(conf) {
267267
result = val;
268268
}
269269

270-
$workflow.state({
270+
$workflow.process({
271271
component: id,
272272
state: propertyName,
273273
data: [result, 'remove']
@@ -448,7 +448,7 @@ function _Array(conf) {
448448
data = result[i];
449449
}
450450

451-
$workflow.state({
451+
$workflow.process({
452452
component: id,
453453
state: propertyName,
454454
data: [data, 'remove']
@@ -880,7 +880,7 @@ function addProperties(model, Class, classId) {
880880
propertyType === 'array' ? 'any' : propertyType[0]
881881
);
882882

883-
$workflow.state({
883+
$workflow.process({
884884
component: this.id(),
885885
state: propertyName,
886886
data: [position, 'reset']
@@ -995,7 +995,7 @@ function addProperties(model, Class, classId) {
995995
});
996996
}
997997

998-
$workflow.state({
998+
$workflow.process({
999999
component: this.id(),
10001000
state: propertyName,
10011001
data: [value, 'add']
@@ -1118,7 +1118,7 @@ function addProperties(model, Class, classId) {
11181118
$behavior.removeFromMemory(this.id());
11191119
}
11201120

1121-
$workflow.state({
1121+
$workflow.process({
11221122
component: this.id(),
11231123
state: propertyName,
11241124
data: [value]
@@ -1226,7 +1226,7 @@ function addStructure(path, name, model, id) {
12261226
if (search.length) {
12271227
setStructureValue(model, id, fullPath, position);
12281228

1229-
$workflow.state({
1229+
$workflow.process({
12301230
component: id,
12311231
state: fullPath,
12321232
data: [position, 'reset']
@@ -1296,7 +1296,7 @@ function addStructure(path, name, model, id) {
12961296
});
12971297
}
12981298

1299-
$workflow.state({
1299+
$workflow.process({
13001300
component: id,
13011301
state: fullPath,
13021302
data: [arr, 'add']
@@ -1414,7 +1414,7 @@ function addStructure(path, name, model, id) {
14141414
$behavior.removeFromMemory(id);
14151415
}
14161416

1417-
$workflow.state({
1417+
$workflow.process({
14181418
component: id,
14191419
state: fullPath,
14201420
data: [value]
@@ -1465,7 +1465,7 @@ function addMethods(model, Class, classId) {
14651465
var proxy = function proxy() {
14661466
var result = null;
14671467

1468-
result = $workflow.state({
1468+
result = $workflow.process({
14691469
component: this.id(),
14701470
state: methodName,
14711471
data: arguments
@@ -1481,7 +1481,7 @@ function addMethods(model, Class, classId) {
14811481
data.shift();
14821482

14831483
if (arguments[0]) {
1484-
result = $workflow.state({
1484+
result = $workflow.process({
14851485
component: this.id(),
14861486
state: methodName,
14871487
data: data,
@@ -1574,7 +1574,7 @@ function addEvents(model, Class, classId) {
15741574

15751575
$db._Message.insert(message);
15761576

1577-
$workflow.state({
1577+
$workflow.process({
15781578
component: this.id(),
15791579
state: 'send',
15801580
data: [
@@ -1586,7 +1586,7 @@ function addEvents(model, Class, classId) {
15861586
]
15871587
});
15881588
} else {
1589-
$workflow.state({
1589+
$workflow.process({
15901590
component: this.id(),
15911591
state: methodName,
15921592
data: arguments
@@ -1667,7 +1667,10 @@ function addOn(Class, classId) {
16671667

16681668
currentState = $state.get(this.id());
16691669
if (currentState && currentState.state === state) {
1670-
$workflow.behavior(behaviorId, currentState.value);
1670+
$workflow.process({
1671+
id: behaviorId,
1672+
data: currentState.value
1673+
});
16711674
}
16721675
} else {
16731676
$log.invalidParamNumberMethodOn(
@@ -1744,7 +1747,10 @@ function addOnClass(Class, classId) {
17441747

17451748
currentState = $state.get(this.id());
17461749
if (currentState && currentState.state === state) {
1747-
$workflow.behavior(behaviorId, currentState.value);
1750+
$workflow.process({
1751+
id: behaviorId,
1752+
data: currentState.value
1753+
});
17481754
}
17491755
} else {
17501756
$log.invalidParamNumberMethodOn(
@@ -1832,7 +1838,7 @@ function addDestroyClass(Class) {
18321838
});
18331839
}
18341840

1835-
$workflow.state({
1841+
$workflow.process({
18361842
component: id,
18371843
state: 'destroy'
18381844
});

src/db.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ DatabaseCollection.prototype.insert = function insert(document) {
767767
var length = channels.length;
768768
for (var i = 0; i < length; i++) {
769769
channel = $helper.getRuntime().require(channels[i]._id);
770-
$workflow.state({
770+
$workflow.process({
771771
component: channels[i]._id,
772772
state: obj.event,
773773
data: obj.data
@@ -880,13 +880,13 @@ DatabaseCollection.prototype.update = function update(query, update, options) {
880880
});
881881
}
882882
if (type === 'array') {
883-
$workflow.state({
883+
$workflow.process({
884884
component: docs[i]._id,
885885
state: attributeName,
886886
data: [update[attributeName], 'reset']
887887
});
888888
} else {
889-
$workflow.state({
889+
$workflow.process({
890890
component: docs[i]._id,
891891
state: attributeName,
892892
data: [update[attributeName]]

0 commit comments

Comments
 (0)