Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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);
});
@kapilepatel

This comment has been minimized.

Copy link

commented Oct 24, 2018

Why is this code repeated 3 times?

work().then(result => {
  console.log('work done');
  console.log(result);
});

It is confusing, could you write it as

console.log('work done 1');

console.log('work done 2');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.