wacz loading: support wacz 1.0.0! -- update to wabac.js 2.3.0

local file loading: support purge cache + reload for local files when filehandles are used (chrome)
update CHANGES.md
bump to 1.3.1
This commit is contained in:
Ilya Kreymer
2020-11-20 15:38:12 -08:00
parent 1bb14b1299
commit 4155b9af33
9 changed files with 69 additions and 63 deletions
+9 -3
View File
@@ -20,6 +20,8 @@ class Loader extends LitElement
this.currentSize = 0;
this.totalSize = 0;
this.tryFileHandle = !!window.showOpenFilePicker;
}
static get properties() {
@@ -35,7 +37,8 @@ class Loader extends LitElement
total: { type: Number },
status: { type: String },
coll: { type: String },
embed: { type: String }
embed: { type: String },
tryFileHandle: { type: Boolean }
}
}
@@ -57,6 +60,9 @@ class Loader extends LitElement
if (event.data.error) {
this.error = event.data.error;
this.state = "errored";
if (this.error === "missing_local_file") {
this.tryFileHandle = false;
}
}
if (event.data.currentSize && event.data.totalSize) {
this.currentSize = event.data.currentSize;
@@ -114,7 +120,7 @@ Please try loading this page from an HTTPS URL`;
break;
case "file":
if (!this.loadInfo) {
if (!this.loadInfo && !this.tryFileHandle) {
this.state = "errored";
this.error = `\
File URLs can not be entered directly or shared.
@@ -179,7 +185,7 @@ You can select a file to upload from the main page by clicking the \'Choose File
}
updated(changedProperties) {
if (this.sourceUrl && changedProperties.has("sourceUrl")) {
if (this.sourceUrl && changedProperties.has("sourceUrl") || changedProperties.has("tryFileHandle")) {
this.doLoad();
}
}