From 494bc6f0838f5bbfc034d2f2d7b553825ce3f28a Mon Sep 17 00:00:00 2001 From: Nicola Greco Date: Fri, 19 Sep 2014 15:34:00 -0700 Subject: [PATCH] Implementing method startREPL --- index.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index 0bcfa40..e8f3c54 100644 --- a/index.js +++ b/index.js @@ -17,21 +17,23 @@ FirefoxREPL.prototype = { if (err) throw err; console.log(tab.url.yellow); - - this.setTab(tab) - - this.repl = repl.start({ - prompt: this.getPrompt(), - eval: this.eval.bind(this), - input: process.stdin, - output: process.stdout, - writer: this.writer.bind(this) - }); - + this.setTab(tab); + this.startRepl(); this.defineCommands(); }.bind(this)) }, + startREPL: function(opts) { + opts = opts || {}; + this.repl = repl.start({ + prompt: this.getPrompt(), + eval: this.eval.bind(this), + input: opts.stdin || process.stdin, + output: opts.stdout || process.stdout, + writer: this.writer.bind(this) + }); + } + connect: function(options, cb) { var client = new FirefoxClient(); client.connect(options.port, options.host, function() {