Skip to content

Commit e0d1392

Browse files
committed
updated to the latest version
1 parent 654dd5f commit e0d1392

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

frameworks/keyed/targetjs/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frameworks/keyed/targetjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
"webpack": "^5.91.0",
2525
"webpack-cli": "^5.1.4",
2626
"wepback": "^1.0.0",
27-
"targetj": "1.0.139"
27+
"targetj": "1.0.140"
2828
}
2929
}

frameworks/keyed/targetjs/src/main.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ App(new TModel("benchmark", {
88
onClick() {
99
const rows = this.getParent().findChild('rows');
1010
rows.removeAll();
11-
rows.activateTarget('buildData', 1000);
12-
rows.activateTarget('createRows');
11+
rows.activateTarget('buildData', 1000).activateTarget('createRows');
1312
}
1413
});
1514
},
@@ -18,24 +17,25 @@ App(new TModel("benchmark", {
1817
onClick() {
1918
const rows = this.getParent().findChild('rows');
2019
rows.removeAll();
21-
rows.activateTarget('buildData', 10000);
22-
rows.activateTarget('createRows');
20+
rows.activateTarget('buildData', 10000).activateTarget('createRows');
2321
}
2422
});
2523
},
2624
addButton() {
2725
return new TModel('add', {
2826
onClick() {
2927
const rows = this.getParent().findChild('rows');
30-
rows.activateTarget('buildData', 1000);
31-
rows.activateTarget('createRows');
28+
rows.activateTarget('buildData', 1000).activateTarget('createRows');
3229
}
3330
});
3431
},
3532
updateButton() {
3633
return new TModel('update', {
3734
onClick() {
3835
const rows = this.getParent().findChild('rows');
36+
if (!rows.val('rowElements')) {
37+
rows.activateTarget('rowElements');
38+
}
3939
rows.activateTarget('updateEvery10thRow');
4040
}
4141
});
@@ -71,18 +71,21 @@ App(new TModel("benchmark", {
7171
return buildData(this._buildData);
7272
},
7373
_createRows() {
74-
this.val('buildData').forEach((data, index) => {
74+
this.deleteTargetValue('rowElements');
75+
this.prevTargetValue.forEach((data, index) => {
7576
const $tr = this.val('rowTemplate').cloneTemplate();
7677
$tr.attr('data-id', `${index}`);
7778
$tr.query('.id-cell').textContent = data.id;
7879
$tr.query('.label-cell a').textContent = data.label;
7980
this.$dom.append$Dom($tr);
8081
});
8182
},
83+
_rowElements() {
84+
return this.$dom.queryAll('tr');
85+
},
8286
_updateEvery10thRow() {
83-
const rowElements = this.$dom.queryAll('tr');
84-
for (let i = 0; i < rowElements.length; i += 10) {
85-
rowElements[i].querySelector('.label-cell a').textContent += ' !!!';
87+
for (let i = 0; i < this.prevTargetValue.length; i += 10) {
88+
this.prevTargetValue[i].querySelector('.label-cell a').textContent += ' !!!';
8689
}
8790
},
8891
_swap() {

0 commit comments

Comments
 (0)