Skip to content

Commit

Permalink
Export the internal copy of JSZip for extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin committed Jul 17, 2023
1 parent 5ff2a56 commit 9329427
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/virtual-machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ class VirtualMachine extends EventEmitter {
*/
this.exports = {
Sprite,
RenderedTarget
RenderedTarget,
JSZip
};
}

Expand Down Expand Up @@ -569,6 +570,7 @@ class VirtualMachine extends EventEmitter {
}

_addFileDescsToZip (fileDescs, zip) {
// TODO: sort files, smallest first
for (let i = 0; i < fileDescs.length; i++) {
const currFileDesc = fileDescs[i];
zip.file(currFileDesc.fileName, currFileDesc.fileContent);
Expand Down
7 changes: 7 additions & 0 deletions test/unit/tw_vm_exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ test('exports exist', t => {
t.type(vm.exports.RenderedTarget, 'function');
t.end();
});

test('JSZip', t => {
const JSZip = new VM().exports.JSZip;
const zip = new JSZip();
t.type(zip.file, 'function');
t.end();
});

0 comments on commit 9329427

Please sign in to comment.