Comparing version 0.3.10 to 0.3.11
@@ -33,3 +33,3 @@ "use strict"; | ||
var Locations = function () { | ||
function Locations(spine, request) { | ||
function Locations(spine, request, pause) { | ||
_classCallCheck(this, Locations); | ||
@@ -39,2 +39,3 @@ | ||
this.request = request; | ||
this.pause = pause || 100; | ||
@@ -100,4 +101,12 @@ this.q = new _queue2.default(this); | ||
return section.load(this.request).then(function (contents) { | ||
var completed = new _core.defer(); | ||
var locations = this.parse(contents, section.cfiBase); | ||
this._locations = this._locations.concat(locations); | ||
section.unload(); | ||
setTimeout(function () { | ||
return completed.resolve(locations); | ||
}, this.pause); | ||
return completed.promise; | ||
}.bind(this)); | ||
@@ -104,0 +113,0 @@ } |
@@ -53,2 +53,6 @@ "use strict"; | ||
} | ||
this.document = undefined; | ||
this.contents = undefined; | ||
this.output = undefined; | ||
} | ||
@@ -204,2 +208,9 @@ | ||
} | ||
}, { | ||
key: "unload", | ||
value: function unload() { | ||
this.document = undefined; | ||
this.contents = undefined; | ||
this.output = undefined; | ||
} | ||
}]); | ||
@@ -206,0 +217,0 @@ |
{ | ||
"name": "epubjs", | ||
"version": "0.3.10", | ||
"version": "0.3.11", | ||
"description": "Parse and Render Epubs", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -1,2 +0,2 @@ | ||
import {qs, sprint, locationOf} from "./utils/core"; | ||
import {qs, sprint, locationOf, defer} from "./utils/core"; | ||
import Queue from "./utils/queue"; | ||
@@ -12,5 +12,6 @@ import EpubCFI from "./epubcfi"; | ||
class Locations { | ||
constructor(spine, request) { | ||
constructor(spine, request, pause) { | ||
this.spine = spine; | ||
this.request = request; | ||
this.pause = pause || 100; | ||
@@ -26,3 +27,2 @@ this.q = new Queue(this); | ||
this._current = 0; | ||
} | ||
@@ -75,4 +75,10 @@ | ||
.then(function(contents) { | ||
var completed = new defer(); | ||
var locations = this.parse(contents, section.cfiBase); | ||
this._locations = this._locations.concat(locations); | ||
section.unload(); | ||
setTimeout(() => completed.resolve(locations), this.pause); | ||
return completed.promise; | ||
}.bind(this)); | ||
@@ -79,0 +85,0 @@ |
@@ -32,2 +32,6 @@ import { defer } from "./utils/core"; | ||
} | ||
this.document = undefined; | ||
this.contents = undefined; | ||
this.output = undefined; | ||
} | ||
@@ -170,4 +174,10 @@ | ||
} | ||
unload() { | ||
this.document = undefined; | ||
this.contents = undefined; | ||
this.output = undefined; | ||
} | ||
} | ||
export default Section; |
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
2049468
34854