diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/postamble.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/postamble.js b/src/postamble.js index 4796fee3..50db3c30 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -34,8 +34,10 @@ function run(args) { if (Module['preRun']) { if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']]; - while (Module['preRun'].length > 0) { - Module['preRun'].pop()(); + var toRun = Module['preRun']; + Module['preRun'] = []; + for (var i = toRun.length-1; i >= 0; i--) { + toRun[i](); } if (runDependencies > 0) { // a preRun added a dependency, run will be called later |