Skip to content

GM APIs Usage Recommendation #1745

Answered by 7nik
Malix-Labs asked this question in Q&A
Mar 20, 2023 · 1 comments · 8 replies
Discussion options

You must be logged in to vote

When only one choice is possible:
a) you want your userscript to be compatible with Greasemonkey - it supports only GM.* (but it supports only a few of them);
b) the userscript must run at document-start, read settings or some other data and do something synchronously - GM_*.

The only difference for the rest cases is that for GM.*, you need to add await and often declare functions as async. Note, now the top-level await is supported.

Technically, GM.* may have an implementation with less impact on the page-loading performance. Still, on the other hand, it'd be weird to have two separate implementations of sync and async API doing the same thing. Anyway, I don't know much about this and do…

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@7nik
Comment options

@Malix-Labs
Comment options

@7nik
Comment options

@Malix-Labs
Comment options

@7nik
Comment options

Answer selected by Malix-Labs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants