webcomponents / gold-standard

1.03k stars 39 forks source link

Bug in examples: Uncaught SyntaxError: await is only valid in async function #17

Closed WebrealizerZS closed 3 years ago

WebrealizerZS commented 4 years ago

When you try executing this code

await import('./smart/component.m.js');

in browser (Chrome) it would through

Uncaught SyntaxError: await is only valid in async function
JanMiksovsky commented 4 years ago

Just wanted to confirm: are you referring to the example on https://github.com/webcomponents/gold-standard/wiki/Expressed-Dependencies?

Generally speaking, the code fragments provided aren't intended necessarily to be complete as is and ready for copy-and-pasting — it will almost always be necessary to provide additional code that depends on context. Still, if the await example on the above page was confusing to you, it might be worth expanding that particular example.

JanMiksovsky commented 3 years ago

I updated the sample code to sit inside an async function.