Skip to content

Wrap script in async function to fix "await is only valid in async functions" error#34

Open
azrogers wants to merge 1 commit intoLyfhael:mainfrom
azrogers:main
Open

Wrap script in async function to fix "await is only valid in async functions" error#34
azrogers wants to merge 1 commit intoLyfhael:mainfrom
azrogers:main

Conversation

@azrogers
Copy link

Fixes #30.

On Firefox (and maybe other browsers) the script currently gives an Uncaught SyntaxError: await is only valid in async functions, async generators and modules error when run. Wrapping the script in an async closure fixes this.

@fbal98
Copy link

fbal98 commented Sep 1, 2024

Awsome, this should be merged IMO!

@Sebazzz
Copy link

Sebazzz commented Nov 23, 2024

In addition, Firefox does not support the experimental API navigator.userAgentData but you can just set ua to an empty string ("") and it works fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncaught SyntaxError: await is only valid in async functions, async generators and modules

3 participants