Created
November 6, 2014 17:46
-
-
Save jonnor/6d8f2f3fee946a6c3104 to your computer and use it in GitHub Desktop.
NoFlo list components and metadata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var noflo = require('noflo'); | |
var rootdir = './'; | |
var loader = new noflo.ComponentLoader(rootdir); | |
loader.listComponents(function() { | |
console.log(loader.components); | |
Object.keys(loader.components).forEach(function(name) { | |
loader.load(name, function(component) { | |
console.log(name); | |
console.log(component.description); | |
// for each port, should look at the .options key | |
// it has "description, type, datatype etc" | |
console.log(component.inPorts); | |
console.log(component.outPorts); | |
}); | |
}); | |
}); | |
Here's an updated version. Apparently, the load() method's first parameter is returned as null... no idea why that changed but whatever:
var rootdir = './';
var loader = new noflo.ComponentLoader(rootdir);
loader.listComponents(function() {
console.log(loader.components);
Object.keys(loader.components).forEach(function(name) {
loader.load(name, function(derp, component) {
console.log(name);
console.log(component.description);
// for each port, should look at the .options key
// it has "description, type, datatype etc"
console.log(component.inPorts);
console.log(component.outPorts);
});
});
});
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you seem to be running it from NoFlo itself, could be that the "Graph" there is causing a problem?