Note that there are some explanatory texts on larger screens.

plurals
  1. POReconstructing code from closure compiler
    primarykey
    data
    text
    <p>I have two different versions of a javascript file: one works fine, the other performs slower. I've tried Closure Compiler on both files but... because I'm an idiot, after a few months I was happy to notice the original source file of the good version was missing. Not only from my hard disk, but even from my memory (I can't remember which changes I've made).</p> <p>So now I have:</p> <ol> <li><ul> <li>Compressed code of the <em>well</em> working file</li> </ul></li> <li><ul> <li>Compressed code of the <em>bad</em> working file</li> </ul></li> <li><ul> <li>Uncompressed code of the <em>bad</em> working file</li> </ul></li> </ol> <p>I need to reconstruct the well working source file and, gladly, there are really a few differences between the two compressed version.</p> <p>Here's where I need your help. </p> <p>I found this in the <strong>well</strong> working compressed code </p> <pre><code>(function () { // same stuff here })(); requestAnimFrame(O); </code></pre> <p>which goes like this in the <strong>bad</strong> working compressed code</p> <pre><code>B.onload = function () { // same stuff here }; requestAnimFrame(O) </code></pre> <p>So, how exactly can Closure Compiler declare a function without name? And what are those <code>();</code> at the end of the function declaration? How is this realized in uncompressed code? If it might help, this is how it looks like in the uncompressed bad version (which I hope to fix):</p> <pre><code>function init() { // same stuff here } B.onload = function(){ start() } function start() { init() requestAnimFrame(0); } </code></pre> <p>If you want to test the difference by yourself, <a href="http://pulsewave.net/issue/good.html" rel="nofollow">here's the result when using the good code</a> and <a href="http://pulsewave.net/issue/slow.html" rel="nofollow">here's the result when using the bad code</a></p> <p>try to click the logo: cubes slips faster in the first link, if you have a good cpu it shouldn't get killed when running the visuals. The second link, by contrary, seems to overload the cpu and have a different displays when going on in the animation (I can already fix this second problem having spotted the difference in the code and remembered what I changed).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload