I need an universal js library to use it in other user-scripts.
Is it possible to use one user script from other user scripts in Greasemonkey?
What is the @require syntax for the such cases? Or, maybe, there is an other way to do that?
I need an universal js library to use it in other user-scripts.
Is it possible to use one user script from other user scripts in Greasemonkey?
What is the @require syntax for the such cases? Or, maybe, there is an other way to do that?
If you put the library script on a website, you can @require it just like you'd @require any other script.
Another option is to allow extensions local filesystem access, and then you can link the needed the scripts to the one local library version, eg:
// @require file://C:/SomeLibraryScript.user.js
A third option would be to enable the library script on all pages (eg // @match *://*/*), make sure it runs as soon as possible, have it assign its functions to some property of the window, and then have other userscripts use that window property to call it.
A fourth option is to create your scripts with a module bundler like Webpack and have all scripts that need the library just import the library from its file location, like I do here.