Skip to content

Instantly share code, notes, and snippets.

@rybycy
Last active March 15, 2019 18:01
Show Gist options
  • Save rybycy/ebba8b0e1bd0b874f7282f4dc5e68fa1 to your computer and use it in GitHub Desktop.
Save rybycy/ebba8b0e1bd0b874f7282f4dc5e68fa1 to your computer and use it in GitHub Desktop.
module.exports = function(RED) {
var Xvfb = require('xvfb');
var xvfb = new Xvfb();
function StartXvfb(config) {
RED.nodes.createNode(this, config);
var node = this;
node.on('input', function(msg) {
xvfb.startSync();
node.send(msg);
});
}
function EndXvfb(config) {
RED.nodes.createNode(this, config);
var node = this;
node.on('input', function(msg) {
xvfb.end(function() {});
node.send(msg);
});
}
RED.nodes.registerType("start-xvfb", StartXvfb);
RED.nodes.registerType("end-xvfb", StartXvfb);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment