Last active
August 29, 2015 14:21
-
-
Save pevers/5b16a0892f3e5e07e397 to your computer and use it in GitHub Desktop.
Angular ng-repeat benchmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (_g, angular) { | |
'use strict'; | |
angular.module(_g.name) | |
.directive('measureTime', ['$timeout', | |
function($timeout) { | |
return { | |
restrict: 'EA', | |
link: function(scope, element, attrs) { | |
if (scope.$first) { | |
console.time(attrs.measureTime); | |
} | |
if (scope.$last) { | |
$timeout(function() { | |
console.timeEnd(attrs.measureTime); | |
}); | |
} | |
} | |
}; | |
}]); | |
}(window.__globals, window.angular)); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div measure-time="myTimer"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment