mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
24 lines
442 B
JavaScript
24 lines
442 B
JavaScript
|
const { add } = require("./other_cjs_file.cjs");
|
||
|
|
||
|
const missing_toplevel_async = async () => {
|
||
|
return new Promise((resolve) => {
|
||
|
setTimeout(() => {
|
||
|
resolve;
|
||
|
}, 500);
|
||
|
});
|
||
|
};
|
||
|
|
||
|
async function main() {
|
||
|
/// async code doesn't seem to work within this CJS wrapper :(
|
||
|
//const p = await missing_toplevel_async();
|
||
|
|
||
|
const sum = add(2, 3);
|
||
|
if (sum != 5) {
|
||
|
throw ("Bad calculator!");
|
||
|
}
|
||
|
|
||
|
postMessage("hallo");
|
||
|
}
|
||
|
|
||
|
main();
|