Skip to content

Commit

Permalink
Remove setImmediate delay from jszip
Browse files Browse the repository at this point in the history
  • Loading branch information
qsniyg committed Nov 16, 2023
1 parent 616d64e commit 3d8d6b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/jszip.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tools/patch_libs.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ var patch_lib = null;

function patch_jszip(text) {
// don't store in window
// remove setImmediate delay, which causes zipping to be extremely slow
text = text
.replace(/^/, "var _fakeWindow={};\n")
.replace(/\("undefined"!=typeof window.window:"undefined"!=typeof global.global:"undefined"!=typeof self.self:this\)/g, "(_fakeWindow)")
.replace(/\("undefined"!=typeof window.window:void 0!==...:"undefined"!=typeof self\?self:this\)/g, "(_fakeWindow)")
.replace(/if\(typeof window!=="undefined"\){g=window}/, 'if(typeof _fakeWindow!=="undefined"){g=_fakeWindow}')
.replace(/(\.delay=function\(.,.,.\){)[a-zA-Z]+\(function\(\){(.*?)}\)(},)/, "$1$2$3")
.replace(/typeof global !== "undefined" . global/, 'typeof _fakeWindow !== "undefined" ? _fakeWindow');

return libexport_shim(text, "_fakeWindow.JSZip");
Expand Down

0 comments on commit 3d8d6b4

Please sign in to comment.