mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 00:23:25 +02:00
Adding vs-repeat performance test sample.
This commit is contained in:
26
res/test/samples/vs-repeat/vs-repeat-controller.js
Normal file
26
res/test/samples/vs-repeat/vs-repeat-controller.js
Normal file
@@ -0,0 +1,26 @@
|
||||
module.exports = function ($scope) {
|
||||
function getArray(size) {
|
||||
var arr = [];
|
||||
for (var i = 0; i < size; i++) {
|
||||
arr.push({
|
||||
a: '',
|
||||
b: ''
|
||||
})
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
$scope.$watch('arraySize', function (s) {
|
||||
$scope.bar = getArray(+s);
|
||||
});
|
||||
|
||||
var interval = setInterval(function interval() {
|
||||
var t1 = Date.now();
|
||||
$scope.$digest();
|
||||
$scope.digestDuration = (Date.now() - t1);
|
||||
}, 1000);
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
clearInterval(interval);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user