In the productivity tool I've created, there is a daily log of pomodoros completed. Each day's progress is displayed on a timeline with a tomato icon representing each pomodoro. To achieve this visual representation, I am using AngularJS directives, specifically ng-repeat
, as depicted below:
<img ng-repeat="p in range(day.pomosDone) track by $index" src='/img/pomodoro.png'>
(The range
function simply consists of:
$scope.range = function(n) {return new Array(n)}
)
While this method works effectively, it tends to slow down for users who have numerous pomodoros recorded, especially when using Firefox. The performance lag is somewhat expected.
There are alternative approaches to address this issue (even considering the use of jQuery), but none appear to be as elegant or seamless. The data does not require frequent updates post-loading, although potential future enhancements may necessitate revisions based on user data. However, these updates can be easily triggered if needed.