Merge pull request #418 from kiwix/transfer-data-instead-of-copying-between-serviceworker-and-backend

Transfer the data from ZIM to ServiceWorker instead of copying it.
This commit is contained in:
Mossroy 2018-09-22 09:32:17 +02:00 committed by GitHub
commit 7873b751ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -836,7 +836,8 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles
} else { } else {
console.log("Reading binary file..."); console.log("Reading binary file...");
selectedArchive.readBinaryFile(dirEntry, function(fileDirEntry, content) { selectedArchive.readBinaryFile(dirEntry, function(fileDirEntry, content) {
messagePort.postMessage({'action': 'giveContent', 'title' : title, 'content': content}); var message = {'action': 'giveContent', 'title' : title, 'content': content.buffer};
messagePort.postMessage(message, [content.buffer]);
console.log("content sent to ServiceWorker"); console.log("content sent to ServiceWorker");
}); });
} }