GM
APIs Usage Recommendation
#1745
-
Hello! How would you recommend using Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
When only one choice is possible: The only difference for the rest cases is that for Technically, |
Beta Was this translation helpful? Give feedback.
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 addawait
and often declare functions asasync
. 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…