GMCommonAPI.js

GM Common API (GMC) is a simple library designed for easily adding Greasemonkey 4 compatibilty to existing userscripts

目前為 2017-10-25 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/34527/226135/GMCommonAPIjs.js

作者
Stig Nygaard
版本
0.0.1.20171025175439
建立日期
2017-10-25
更新日期
2017-10-25
尺寸
13.4 KB
授權條款
未知

GM Common Library (GMC) is an API designed for easily adding Greasemonkey 4 compatibilty to existing userscripts.

GMC provides a common subset of the functionality offered by the new "asynchronous API" in Greasemonkey 4 (GM.*) and the classic "synchronous API" from other userscript managers (GM_*), offered in a single "classic" synchronous API (GMC.*).

With the introduction of the Greasemonkey 4 WebExtension (currently in beta [todo: link]), the classic GM_* "synchronous" API is replaced with a new GM.* "asynchronous API". The features of the new API in Greasemonkey 4 (GM4) are very similar to the classic API, but the functions are asynchronous. This means you might need to (learn asynchronous programming and) do some refactoring of your existing userscripts to make use of the new API in GM4.

As an alternative to refactoring your code, GMC offers a "synchronous subset" of the GM APIs, which works with scripts running in both the new GM4, in the older versions of Greasemonkey, and in other userscript managers like Tampermonkey and Violentmonkey. Where APIs are supported in GMC, no refactoring of your script is needed; Simply [todo: add GMC script/grants and] replace the use of GM_* methods in your script with equivalent GMC.* methods.

For more info, see GitHub [todo: link] or source code.

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址