violentmonkey / violentmonkey/violentmonkey
[Feature] default to top-level-await
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8.9k
- Forks
- 759
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 3
Description
Motivation
while it's possible via // @top-level-await (#833), i think this behavior could be default.
Proposed Solution
make this flag the default.
Use Cases
- it's convenient to
awaitweb APIs.
const isIncognito = await navigator.storage.getDirectory().then(() => false).catch(() => true)
(code from https://github.com/Joe12387/detectIncognito/issues/51)
- less surprises to people new to userscript that expects valid JS syntax to work
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing implementation of the // @top-level-await flag and issue #833, then trace how userscripts are processed. Test the proposed default with the provided navigator.storage.getDirectory() example and existing scripts; done means top-level await works without the directive while preserving current userscript behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100