I was wondering how to provide user feedback on state of a longer-running calculation. I imagine the implementation will be via a progress property on the controller, which tracks the current progress vs. total number of calculations.
In trying to do this the way I thought would work, it just hangs on 0% complete, and then immediately jumps to 100% complete. I’m sure there’s something I’m doing wrong with tracking the variables, or with the promise implementation.
Any help would be appreciated.
completedTrials: 0 simulate: (noTrials) -> promise = new Ember.RSVP.Promise (resolve, reject) => for trialNumber in [0..noTrials] aVeryHardCalculation() @set 'completedTrials', trialNumber return promise
numberOfSimulationTrials: 200 simulationProgress: @get('completedTrials') / @get('numberOfSimulationTrials') actions: simulate: -> @get('model').simulate(@get 'numberOfSimulationTrials').then () => console.log "Done!"