test of esm module's 'then' export
run ./test.js
, which will run ./main.js
and check that the console output is as expected.
did you know that esm have a special then
export that gets run on load? it's true.
in target-then.js
we see:
export async function then(){
/* [async code here] */
}
console.log("target-then console")
this then
export should have two effects:
- it will get run when the module is loaded
- the import will be delayed until then completes