Permalink
Browse files

simple example

  • Loading branch information...
1 parent f8343f3 commit 3bf5bd401cae9b7f5eee1fcc34141cec034e2829 @substack committed Nov 6, 2012
View
@@ -1,7 +1,7 @@
var fs = require('fs');
var scoper = require('../');
-var src = fs.readFileSync(__dirname + '/source.js', 'utf8');
+var src = fs.readFileSync(__dirname + '/source/nested.js', 'utf8');
var c = Function('return ' + scoper(src))();
c.run();
View
@@ -0,0 +1,14 @@
+var fs = require('fs');
+var scoper = require('../');
+
+var src = fs.readFileSync(__dirname + '/source/simple.js', 'utf8');
+var c = Function('return ' + scoper(src))();
+c.run();
+
+setInterval(function () {
+ c.literal['arguments.0'][0] += 10;
+}, 500);
+
+setTimeout(function () {
+ c.scope[''].x = 11;
+}, 2000);
File renamed without changes.
View
@@ -0,0 +1,5 @@
+var x = 3;
+
+setInterval(function () {
+ console.log(100 * x);
+}, 500);
View
@@ -1,6 +1,6 @@
var fs = require('fs');
var scoper = require('../');
-var src = fs.readFileSync(__dirname + '/source.js', 'utf8');
+var src = fs.readFileSync(__dirname + '/source/nested.js', 'utf8');
var out = scoper(src);
console.log(out);

0 comments on commit 3bf5bd4

Please sign in to comment.