Last active
February 27, 2019 21:29
-
-
Save ccnokes/d2663f474022f75591cb946d16298747 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This works in the either the main or renderer processes. | |
const { requireTaskPool } = require('electron-remote'); | |
const work = requireTaskPool(require.resolve('./work')); | |
console.log('start work'); | |
// `work` will get executed concurrently in separate processes | |
work().then(result => { | |
console.log('work done'); | |
console.log(result); | |
}); | |
work().then(result => { | |
console.log('work done'); | |
console.log(result); | |
}); | |
work().then(result => { | |
console.log('work done'); | |
console.log(result); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why is this code repeated 3 times?
It is confusing, could you write it as