Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

...

  • Loading branch information...
commit 36d3f5e160cbafe564f1615ef62f9c30886e73dd 1 parent d63fb23
ry authored February 07, 2011

Showing 2 changed files with 10 additions and 17 deletions. Show diff stats Hide diff stats

  1. 24  lib/module.js
  2. 3  src/node.js
24  lib/module.js
@@ -213,14 +213,14 @@ Module._load = function(request, parent, isMain) {
213 213
       if (module.timeout) return;
214 214
 
215 215
       module.timeout = setTimeout(function() {
216  
-        console.error(module.filename + ': change detected. reloading.');
  216
+        debug(module.filename + ': change detected. reloading.');
217 217
 
218 218
         module.reload(function() {
219  
-          console.error(module.filename + ': done reloading.');
  219
+          debug(module.filename + ': done reloading.');
220 220
         });
221 221
 
222 222
         module.timeout = null;
223  
-      }, 1000);
  223
+      }, 200);
224 224
 
225 225
     });
226 226
   }
@@ -251,31 +251,25 @@ Module._resolveFilename = function(request, parent) {
251 251
 
252 252
 Module.prototype.reload = function(cb) {
253 253
   var self = this;
254  
-  debugger;
255  
-  //var newSource = require('fs').readFileSync(this.filename, 'utf8');
256  
-  console.log("DONE");
257  
-  //console.log(newSource);
258  
-
259 254
 
260 255
   require('fs').readFile(this.filename, 'utf8', function(err, newSource) {
261 256
 
262 257
     if (err) throw err;
263 258
 
264  
-    console.log(arguments);
265 259
     var script = Debug.findScript(self.compiledWrapper);
  260
+    var scripts = Debug.scripts();
  261
+
  262
+    var wrappedNewSource = Module.wrap(newSource)
266 263
 
267 264
     /*
268  
-    console.log("old source");
269  
-    console.log(script.source);
270 265
     console.log("new source");
271 266
     console.log(newSource);
272 267
     */
273 268
 
274  
-    var changeLog = new Array();
275  
-    var rv = Debug.LiveEdit.SetScriptSource(script, newSource, false, changeLog);
  269
+    var changeLog = [];
  270
+    var rv = Debug.LiveEdit.SetScriptSource(script, wrappedNewSource, false, changeLog);
  271
+
276 272
 
277  
-    console.log("rv ", rv);
278  
-    console.log("change log", changeLog);
279 273
     if (cb) cb(changeLog);
280 274
   });
281 275
 };
3  src/node.js
@@ -410,14 +410,13 @@
410 410
   }
411 411
 
412 412
   NativeModule.wrap = function(script) {
413  
-    this.functionid = ++NativeModule.functionid;
414 413
     return NativeModule.wrapper[0] +
415 414
            script +
416 415
            NativeModule.wrapper[1];
417 416
   };
418 417
 
419 418
   NativeModule.wrapper = [
420  
-    '(function __f(exports, require, module, __filename, __dirname) { ',
  419
+    '(function (exports, require, module, __filename, __dirname) { ',
421 420
     '\n});'
422 421
   ];
423 422
 

0 notes on commit 36d3f5e

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