Merge pull request #134 from peter-x/binaries

Reading binary files.
This commit is contained in:
Mossroy 2016-01-07 16:14:35 +01:00
commit 6fbfb7254c
4 changed files with 7 additions and 5 deletions

View File

@ -68,9 +68,9 @@ self.addEventListener('activate', function(event) {
require({
baseUrl: "./www/js/lib/"
},
["util", "utf8"],
["util"],
function(util, utf8) {
function(util) {
console.log("ServiceWorker startup");

View File

@ -777,11 +777,11 @@ define(['jquery', 'abstractBackend', 'util', 'cookies','geometry','osabstraction
console.log("Reading binary file...");
selectedArchive.readBinaryFile(title, function(readableTitleName, content) {
messagePort.postMessage({'action': 'giveContent', 'titleName' : titleName, 'content': content});
console.log("content sent to ServiceWorker)");
console.log("content sent to ServiceWorker");
});
}
}
console.log("Fetching tile " + titleName);
console.log("Fetching title " + titleName);
selectedArchive.getTitleByName(titleName).then(readFile).fail(function() {
console.log("could not find title:" + arguments);
messagePort.postMessage({'action': 'giveContent', 'titleName' : titleName, 'content': new UInt8Array()});

View File

@ -338,6 +338,7 @@ define(['normalize_string', 'geometry', 'title', 'util', 'titleIterators', 'q'],
* Look for a title by its name, and call the callbackFunction with this Title
* If the title is not found, the callbackFunction is called with parameter null
* @param {String} titleName
* @return {Promise} resolving to the title object or null if not found.
*/
LocalArchive.prototype.getTitleByName = function(titleName) {
var that = this;

View File

@ -198,8 +198,9 @@ define(['zimfile', 'zimDirEntry', 'util', 'utf8'],
};
/**
*
* Searches a title (article / page) by name.
* @param {String} titleName
* @return {Promise} resolving to the title object or null if not found.
*/
ZIMArchive.prototype.getTitleByName = function(titleName) {
var that = this;