Greasy Fork is available in English.

ExtMan

A Simple Extension Manager

ეს სკრიპტი არ უნდა იყოს პირდაპირ დაინსტალირებული. ეს ბიბლიოთეკაა, სხვა სკრიპტებისთვის უნდა ჩართეთ მეტა-დირექტივაში // @require https://update.greasyfork.org/scripts/441384/1027332/ExtMan.js.

ავტორი
CKylinMC
ვერსია
1.0
შექმნილია
12.03.2022
განახლებულია
12.03.2022
ლიცენზია
GPLv3 License

独立用户脚本做附加模块框架。Host和Module都需要引用此脚本。

Host:

const ExtMan = unsafeWindow.getExtMan();
const ext = new ExtMan({
    name: "YourHostScriptNamespace",
    requiredProperties:{// specify this for module precheck or leave this empty object to skip precheck
        name:"string",
        version:"string",
        onhook: (prop, fullmodule, propname)=>true // custom checker
    }
});
ext.getAllModules();// get all registered module with precheck, return an array

External Module:

const ExtMan = unsafeWindow.getExtMan();
const ext = new ExtMan({
    name: "TheNamespaceOfYourHostScript",
});
ext.registerModule({// register your module with object like this. Make sure your module script load before the host script!
    name: "...",
    //...
});