How to use the @node-red/registry.installModule function in @node-red/registry

To help you get started, we’ve selected a few @node-red/registry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-red / node-red / packages / node_modules / @node-red / runtime / lib / nodes / index.js View on Github external
function installModule(module,version) {
    var existingModule = registry.getModuleInfo(module);
    var isUpgrade = !!existingModule;
    return registry.installModule(module,version).then(function(info) {
        if (isUpgrade) {
            events.emit("runtime-event",{id:"node/upgraded",retain:false,payload:{module:module,version:version}});
        } else {
            events.emit("runtime-event",{id:"node/added",retain:false,payload:info.nodes});
        }
        return info;
    });
}