Skip to content

Commit

Permalink
Further refactors and simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Oct 15, 2021
1 parent ce1e336 commit dadb8e4
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/components/fields/Janitor.vue
Expand Up @@ -84,16 +84,21 @@ export default {
},
created() {
this.$events.$on("model.update", this.modelHasUpdate);
this.$events.$on(
"model.update",
() => sessionStorage.getItem("clickAfterAutosave") && location.reload()
);
this.clickAfterAutosave();
},
methods: {
// https://stackoverflow.com/a/8831937
/**
* Source: https://stackoverflow.com/a/8831937
*/
hashCode(str) {
let hash = 0;
if (str.length == 0) return hash;
if (str.length === 0) return hash;
for (let i = 0; i < str.length; i++) {
let char = str.charCodeAt(i);
Expand All @@ -104,12 +109,6 @@ export default {
return hash;
},
modelHasUpdate() {
if (sessionStorage.getItem("clickAfterAutosave")) {
location.reload();
}
},
clickAfterAutosave() {
if (sessionStorage.getItem("clickAfterAutosave") === this.id) {
sessionStorage.removeItem("clickAfterAutosave");
Expand Down Expand Up @@ -176,8 +175,7 @@ export default {
},
async getRequest(url) {
this.btnLabel =
(this.progress?.length ?? 0) > 0 ? this.progress : `${this.label}`;
this.btnLabel = this.progress ?? `${this.label}`;
this.btnClass = "is-running";
const { label, status, reload, href, download, clipboard } =
Expand Down Expand Up @@ -225,9 +223,6 @@ export default {
}
},
/**
* Taken from https://gomakethings.com/how-to-simulate-a-click-event-with-javascript/
*/
simulateClick(element) {
const evt = new MouseEvent("click", {
bubbles: true,
Expand Down

0 comments on commit dadb8e4

Please sign in to comment.