2024-01-12 17:10:42 -05:00
|
|
|
import chalk from "npm:chalk";
|
|
|
|
import process from "node:process";
|
|
|
|
|
|
|
|
console.log(chalk.red("Hello world!"));
|
|
|
|
|
|
|
|
globalThis.addEventListener("unhandledrejection", (e) => {
|
|
|
|
console.log('globalThis.addEventListener("unhandledrejection");');
|
|
|
|
e.preventDefault();
|
|
|
|
});
|
|
|
|
|
|
|
|
globalThis.addEventListener("rejectionhandled", (_) => {
|
|
|
|
console.log("Web rejectionhandled");
|
|
|
|
});
|
|
|
|
|
|
|
|
process.on("rejectionHandled", (_) => {
|
|
|
|
console.log("Node rejectionHandled");
|
|
|
|
});
|
|
|
|
|
|
|
|
const a = Promise.reject(1);
|
|
|
|
setTimeout(() => {
|
|
|
|
a.catch(() => console.log("Added catch handler to the promise"));
|
2024-01-23 16:05:21 -05:00
|
|
|
}, 100);
|
2024-01-12 17:10:42 -05:00
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
console.log("Success");
|
2024-04-18 19:40:15 -04:00
|
|
|
}, 1000);
|