I have a module:
var progress = {
val: 0
};
var service = (function(){
function someMethod(){
progress.val++;
}
return{
someMethod: someMethod
};
})();
export {service,progress}
someMethod
will perform an operation where an array is iterated. I would like to increment progress.val
by one at each iteration. This progress should then be observable:
System.import('components/Service.js')
.then(function(M){
self.progress = M.progress;
Object.observe(M.progress,function(c){
console.dir(c);
});
});
Unfortunately, the observers callback is invoked only once, holding an array of changes with one item per iteration.
How can I invoke the callback on each iteration?