Skip to content

Commit

Permalink
Clean eport start from bebop.js.
Browse files Browse the repository at this point in the history
  • Loading branch information
zeekay committed Mar 26, 2012
1 parent 9012f32 commit 28b2743
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
17 changes: 2 additions & 15 deletions bin/bebop-client
Original file line number Original file line Diff line number Diff line change
@@ -1,17 +1,4 @@
#!/usr/bin/env node #!/usr/bin/env node


var util = require('util'), var bebop = require('bebop');
repl = require('repl'), bebop.start(true);
Bebop = require('bebop');

// colorful output
repl.writer = function(obj, showHidden, depth) {
return util.inspect(obj, showHidden, depth, true);
};

bebop = new Bebop();
bebop.onconnect = function() {
repl.start('bebop> ', null, null, true);
}
bebop.exportGlobals();
bebop.connect();
23 changes: 21 additions & 2 deletions lib/bebop.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -405,12 +405,31 @@
} }
}; };


var bebop = new Bebop();

if (isBrowser) { if (isBrowser) {
var bebop = new Bebop();
bebop.connect(); bebop.connect();
bebop.exportGlobals(); bebop.exportGlobals();
} else { } else {
module.exports = Bebop; exports.Bebop = Bebop;
exports.start = function(useRepl) {
if (useRepl) {
var util = require('util'),
repl = require('repl');

// colorful output
repl.writer = function(obj, showHidden, depth) {
return util.inspect(obj, showHidden, depth, true);
};

bebop.onopen = function() {
repl.start('bebop> ', null, null, true);
}

bebop.exportGlobals();
}
bebop.connect();
}
} }


})(); })();

0 comments on commit 28b2743

Please sign in to comment.