Permalink
Browse files

Clean eport start from bebop.js.

  • Loading branch information...
1 parent 9012f32 commit 28b274360403b5402cd27d1d7611a7b89bdea353 @zeekay committed Mar 26, 2012
Showing with 23 additions and 17 deletions.
  1. +2 −15 bin/bebop-client
  2. +21 −2 lib/bebop.js
View
@@ -1,17 +1,4 @@
#!/usr/bin/env node
-var util = require('util'),
- repl = require('repl'),
- 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();
+var bebop = require('bebop');
+bebop.start(true);
View
@@ -405,12 +405,31 @@
}
};
+ var bebop = new Bebop();
+
if (isBrowser) {
- var bebop = new Bebop();
bebop.connect();
bebop.exportGlobals();
} 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.