Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
export function inTheBackground<T>(doSomething: () => T): Promise<T> {
return new Promise(async (resolve, reject) => {
try {
resolve(await doSomething());
} catch (err) {
reject(err);
}
});
}
April 24, 2024