Skip to content

Commit

Permalink
Send across ipc only unique value (#56)
Browse files Browse the repository at this point in the history
* Send across ipc only unique value

* Fix equality check.

Co-authored-by: Daniel Scalzi <[email protected]>
  • Loading branch information
VolanDeVovan and dscalzi authored Apr 12, 2020
1 parent 141a753 commit 9d1aa49
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/assets/js/assetexec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@ console.log('AssetExec Started')
// Temporary for debug purposes.
process.on('unhandledRejection', r => console.log(r))

let percent = 0
function assignListeners(){
tracker.on('validate', (data) => {
process.send({context: 'validate', data})
})
tracker.on('progress', (data, acc, total) => {
process.send({context: 'progress', data, value: acc, total, percent: parseInt((acc/total)*100)})
const currPercent = parseInt((acc/total) * 100)
if (currPercent !== percent) {
percent = currPercent
process.send({context: 'progress', data, value: acc, total, percent})
}
})
tracker.on('complete', (data, ...args) => {
process.send({context: 'complete', data, args})
Expand Down

0 comments on commit 9d1aa49

Please sign in to comment.