Siorki / RegPack

Self-contained packer for size-constrained JS code
Other
298 stars 14 forks source link

Support for default parameters when refactoring setInterval() #56

Closed Siorki closed 7 years ago

Siorki commented 7 years ago

Issue identified when working on #44 ES6 introduces default values for function parameters. Currently, using these in the input codecauses the module to fail.

The input

init_code();
setInterval(function(a=0,b=1) { /* contents */}, delay);

should become

if (!t){init_code();}a=0,b=1;/* contents */}

The declarations are inserted at the beginning of the core loop.