Created
January 3, 2014 13:56
-
-
Save obenjiro/8238228 to your computer and use it in GitHub Desktop.
Live reload JS proof of concept
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function outer(t){ | |
for (var i = 0; i<3; i++){ | |
function test(){return gl()(); | |
var a = 1; | |
console.log(a + b); | |
} | |
console.log(test()); | |
} | |
} | |
var f = true; | |
function getLatestVersion(){ | |
var result = ''; | |
if (f) result = 'var b = 2;\nt = 0;\nvar a = 2 + t;\ns=console.log.bind(console);console.log(a + b);'; | |
else result = 's(1);return 2;'; | |
f = false; | |
return result; | |
} | |
function gl(){ | |
return eval( "(function(){" + getLatestVersion() + "})" ); | |
} | |
outer(1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment