Send across ipc only unique value (#56)
* Send across ipc only unique value * Fix equality check. Co-authored-by: Daniel Scalzi <d_scalzi@yahoo.com>
This commit is contained in:
parent
141a753893
commit
9d1aa497a7
@ -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})
|
||||
|
Loading…
Reference in New Issue
Block a user