Skip to content

Commit

Permalink
temp: bootcode
Browse files Browse the repository at this point in the history
  • Loading branch information
appurva21 committed Apr 30, 2024
1 parent 72c7175 commit 1990b3b
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions hack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* eslint-disable one-var */
const { Worker, isMainThread } = require('worker_threads');

const worker = new Worker(`
const { isMainThread } = require("worker_threads");
console.log("isMainThread", isMainThread);
console.log("Worker", process.on);
// (async () => {
// try {
// async function main () {
// return Promise.reject(new Error('something error'));
// }
// main();
// } catch (e) {
// console.log('$$$ err', e);
// }
// })()
setTimeout(() => {
console.log('timeout');
}, 4000);
process.on('unhandledRejection', function (err) {
console.log('$$$ unhandledRejection', err);
});
`, { eval: true });


console.log('isMainThread', isMainThread);
console.log('Main thread', process.on);

// process.on('unhandledRejection', function (err) {
// console.log('$$$ unhandledRejection', err);
// });

// try {
// async function main () {
// return await Promise.reject(new Error('something error'));
// }

// (async () => await main())();
// // await main();
// } catch (e) {
// console.log('$$$ err', e);
// }

0 comments on commit 1990b3b

Please sign in to comment.