Adding fixes to simpler find bugs

This commit is contained in:
Martin Karkowski 2021-10-18 08:02:19 +02:00
parent 596bdcd7c8
commit 582bcfb3a3

View File

@ -17,15 +17,28 @@ const _runningInNode = (
* Function to call a function something direct async
*/
export const callImmediate = _runningInNode ? (callback: (...args) => void, ...args) => {
// return setTimeout(callback, 0, ...args);
const trace = new Error("Error for Bugtracing");
return setImmediate(() => {
try {
callback(...args);
} catch (error) {
console.error(error);
console.log("Trancing Bug with the Following Error");
console.error(trace);
}
});
} : (callback: (...args) => void, ...args) => {
return setTimeout(callback, 0, ...args);
const trace = new Error("Error for Bugtracing");
return setTimeout(() => {
try {
callback(...args);
} catch (error) {
console.error(error);
console.log("Trancing Bug with the Following Error");
console.error(trace);
}
}, 0);
};
export const callDirect = (callback: (...args) => void, ...args) => {