mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 15:26:16 -04:00
Abstracted out loadFile logic to separate function
This commit is contained in:
parent
d71aa8d7e2
commit
13abbd2c5d
1 changed files with 18 additions and 14 deletions
|
@ -243,11 +243,7 @@ class InputWaiter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
this.closeFile();
|
this.loadFile(file);
|
||||||
this.loaderWorker = new LoaderWorker();
|
|
||||||
this.loaderWorker.addEventListener("message", this.handleLoaderMessage.bind(this));
|
|
||||||
this.loaderWorker.postMessage({"file": file});
|
|
||||||
this.set(file);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,16 +255,8 @@ class InputWaiter {
|
||||||
*/
|
*/
|
||||||
inputOpen(e) {
|
inputOpen(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const file = e.srcElement.files[0];
|
const file = e.srcElement.files[0];
|
||||||
|
this.loadFile(file);
|
||||||
if (file) {
|
|
||||||
this.closeFile();
|
|
||||||
this.loaderWorker = new LoaderWorker();
|
|
||||||
this.loaderWorker.addEventListener("message", this.handleLoaderMessage.bind(this));
|
|
||||||
this.loaderWorker.postMessage({"file": file});
|
|
||||||
this.set(file);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -326,6 +314,22 @@ class InputWaiter {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads a file into the input.
|
||||||
|
*
|
||||||
|
* @param {File} file
|
||||||
|
*/
|
||||||
|
loadFile(file) {
|
||||||
|
if (file) {
|
||||||
|
this.closeFile();
|
||||||
|
this.loaderWorker = new LoaderWorker();
|
||||||
|
this.loaderWorker.addEventListener("message", this.handleLoaderMessage.bind(this));
|
||||||
|
this.loaderWorker.postMessage({"file": file});
|
||||||
|
this.set(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for clear IO events.
|
* Handler for clear IO events.
|
||||||
* Resets the input, output and info areas.
|
* Resets the input, output and info areas.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue