New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

epubjs

Package Overview
Dependencies
Maintainers
2
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

epubjs - npm Package Compare versions

Comparing version 0.3.76 to 0.3.77

2

lib/rendition.js

@@ -74,3 +74,3 @@ "use strict";

* Requires Manager and View class to handle specifics of rendering
* the section contetn.
* the section content.
* @class

@@ -77,0 +77,0 @@ * @param {Book} book

@@ -34,2 +34,5 @@ "use strict";

* @class
* @param {string} name This should be the name of the application for modals
* @param {function} [requester]
* @param {function} [resolver]
*/

@@ -42,2 +45,5 @@ var Store = function () {

this.storage = undefined;
this.name = name;
this.requester = requester || _request2.default;

@@ -50,7 +56,2 @@ this.resolver = resolver;

// This should be the name of the application for modals
localforage.config({
name: name || 'epubjs'
});
this.addListeners();

@@ -70,5 +71,11 @@ }

try {
if (typeof localForage === "undefined") {
var _localForage = require("localforage");
var store = void 0;
if (typeof localforage === "undefined") {
store = require("localforage");
} else {
store = localforage;
}
this.storage = store.createInstance({
name: this.name
});
} catch (e) {

@@ -138,6 +145,6 @@ throw new Error("localForage lib not loaded");

return localforage.getItem(encodedUrl).then(function (item) {
return _this.storage.getItem(encodedUrl).then(function (item) {
if (!item || force) {
return _this.requester(url, "binary").then(function (data) {
return localforage.setItem(encodedUrl, data);
return _this.storage.setItem(encodedUrl, data);
});

@@ -155,2 +162,4 @@ } else {

* @param {string} url a url to request from storage
* @param {boolean} [withCredentials]
* @param {object} [headers]
* @return {Promise<Blob>}

@@ -161,3 +170,3 @@ */

key: "put",
value: function put(url) {
value: function put(url, withCredentials, headers) {
var _this2 = this;

@@ -167,6 +176,6 @@

return localforage.getItem(encodedUrl).then(function (result) {
return this.storage.getItem(encodedUrl).then(function (result) {
if (!result) {
return _this2.requester(url, "binary", withCredentials, headers).then(function (data) {
return localforage.setItem(encodedUrl, data);
return _this2.storage.setItem(encodedUrl, data);
});

@@ -288,3 +297,3 @@ }

return localforage.getItem(encodedUrl).then(function (uint8array) {
return this.storage.getItem(encodedUrl).then(function (uint8array) {
if (!uint8array) return;

@@ -312,9 +321,11 @@

return localforage.getItem(encodedUrl).then(function (uint8array) {
return this.storage.getItem(encodedUrl).then(function (uint8array) {
var deferred = new _core.defer();
var reader = new FileReader();
var blob = new Blob([uint8array], { type: mimeType });
var blob;
if (!blob) return;
if (!uint8array) return;
blob = new Blob([uint8array], { type: mimeType });
reader.addEventListener("loadend", function () {

@@ -344,9 +355,11 @@ deferred.resolve(reader.result);

return localforage.getItem(encodedUrl).then(function (uint8array) {
return this.storage.getItem(encodedUrl).then(function (uint8array) {
var deferred = new _core.defer();
var reader = new FileReader();
var blob = new Blob([uint8array], { type: mimeType });
var blob;
if (!blob) return;
if (!uint8array) return;
blob = new Blob([uint8array], { type: mimeType });
reader.addEventListener("loadend", function () {

@@ -353,0 +366,0 @@ deferred.resolve(reader.result);

{
"name": "epubjs",
"version": "0.3.76",
"version": "0.3.77",
"description": "Parse and Render Epubs",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -23,3 +23,3 @@ import EventEmitter from "event-emitter";

* Requires Manager and View class to handle specifics of rendering
* the section contetn.
* the section content.
* @class

@@ -26,0 +26,0 @@ * @param {Book} book

@@ -10,2 +10,5 @@ import {defer, isXml, parse} from "./utils/core";

* @class
* @param {string} name This should be the name of the application for modals
* @param {function} [requester]
* @param {function} [resolver]
*/

@@ -17,2 +20,5 @@ class Store {

this.storage = undefined;
this.name = name;
this.requester = requester || httpRequest;

@@ -25,7 +31,2 @@ this.resolver = resolver;

// This should be the name of the application for modals
localforage.config({
name: name || 'epubjs'
});
this.addListeners();

@@ -41,5 +42,11 @@ }

try {
if (typeof localForage === "undefined") {
let localForage = require("localforage");
let store;
if (typeof localforage === "undefined") {
store = require("localforage");
} else {
store = localforage;
}
this.storage = store.createInstance({
name: this.name
});
} catch (e) {

@@ -94,7 +101,7 @@ throw new Error("localForage lib not loaded");

return localforage.getItem(encodedUrl).then((item) => {
return this.storage.getItem(encodedUrl).then((item) => {
if (!item || force) {
return this.requester(url, "binary")
.then((data) => {
return localforage.setItem(encodedUrl, data);
return this.storage.setItem(encodedUrl, data);
});

@@ -113,11 +120,13 @@ } else {

* @param {string} url a url to request from storage
* @param {boolean} [withCredentials]
* @param {object} [headers]
* @return {Promise<Blob>}
*/
put(url) {
put(url, withCredentials, headers) {
let encodedUrl = window.encodeURIComponent(url);
return localforage.getItem(encodedUrl).then((result) => {
return this.storage.getItem(encodedUrl).then((result) => {
if (!result) {
return this.requester(url, "binary", withCredentials, headers).then((data) => {
return localforage.setItem(encodedUrl, data);
return this.storage.setItem(encodedUrl, data);
});

@@ -231,3 +240,3 @@ }

return localforage.getItem(encodedUrl).then(function(uint8array) {
return this.storage.getItem(encodedUrl).then(function(uint8array) {
if(!uint8array) return;

@@ -253,9 +262,11 @@

return localforage.getItem(encodedUrl).then(function(uint8array) {
return this.storage.getItem(encodedUrl).then(function(uint8array) {
var deferred = new defer();
var reader = new FileReader();
var blob = new Blob([uint8array], {type : mimeType});
var blob;
if(!blob) return;
if(!uint8array) return;
blob = new Blob([uint8array], {type : mimeType});
reader.addEventListener("loadend", () => {

@@ -282,9 +293,11 @@ deferred.resolve(reader.result);

return localforage.getItem(encodedUrl).then((uint8array) => {
return this.storage.getItem(encodedUrl).then((uint8array) => {
var deferred = new defer();
var reader = new FileReader();
var blob = new Blob([uint8array], {type : mimeType});
var blob;
if(!blob) return;
if(!uint8array) return;
blob = new Blob([uint8array], {type : mimeType});
reader.addEventListener("loadend", () => {

@@ -291,0 +304,0 @@ deferred.resolve(reader.result);

@@ -26,3 +26,4 @@ import {

canonical?: (path: string) => string,
openAs?: string
openAs?: string,
store?: string
}

@@ -29,0 +30,0 @@

@@ -5,7 +5,7 @@ import localForage = require('localforage');

export default class Store {
constructor();
constructor(name: string, request?: Function, resolver?: Function);
add(resources: Resources, force?: boolean): Promise<Array<object>>;
put(url: string): Promise<Blob>;
put(url: string, withCredentials?: boolean, headers?: object): Promise<Blob>;

@@ -12,0 +12,0 @@ request(url: string, type?: string, withCredentials?: boolean, headers?: object): Promise<Blob | string | JSON | Document | XMLDocument>;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc