Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Clean eport start from bebop.js.

  • Loading branch information...
commit 28b274360403b5402cd27d1d7611a7b89bdea353 1 parent 9012f32
Zach Kelling authored March 26, 2012
17  bin/bebop-client
... ...
@@ -1,17 +1,4 @@
1 1
 #!/usr/bin/env node
2 2
 
3  
-var util  = require('util'),
4  
-    repl  = require('repl'),
5  
-    Bebop = require('bebop');
6  
-
7  
-// colorful output
8  
-repl.writer = function(obj, showHidden, depth) {
9  
-    return util.inspect(obj, showHidden, depth, true);
10  
-};
11  
-
12  
-bebop = new Bebop();
13  
-bebop.onconnect = function() {
14  
-    repl.start('bebop> ', null, null, true);
15  
-}
16  
-bebop.exportGlobals();
17  
-bebop.connect();
  3
+var bebop = require('bebop');
  4
+bebop.start(true);
23  lib/bebop.js
@@ -405,12 +405,31 @@
405 405
         }
406 406
     };
407 407
 
  408
+    var bebop = new Bebop();
  409
+
408 410
     if (isBrowser) {
409  
-        var bebop = new Bebop();
410 411
         bebop.connect();
411 412
         bebop.exportGlobals();
412 413
     } else {
413  
-        module.exports = Bebop;
  414
+        exports.Bebop = Bebop;
  415
+        exports.start = function(useRepl) {
  416
+            if (useRepl) {
  417
+                var util  = require('util'),
  418
+                    repl  = require('repl');
  419
+
  420
+                // colorful output
  421
+                repl.writer = function(obj, showHidden, depth) {
  422
+                    return util.inspect(obj, showHidden, depth, true);
  423
+                };
  424
+
  425
+                bebop.onopen = function() {
  426
+                    repl.start('bebop> ', null, null, true);
  427
+                }
  428
+
  429
+                bebop.exportGlobals();
  430
+            }
  431
+            bebop.connect();
  432
+        }
414 433
     }
415 434
 
416 435
 })();

0 notes on commit 28b2743

Please sign in to comment.
Something went wrong with that request. Please try again.