mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 15:26:16 -04:00
ESM: Ported DateTime operations
This commit is contained in:
parent
10005ce104
commit
bad45f19d6
7 changed files with 661 additions and 1 deletions
47
src/core/operations/Sleep.mjs
Normal file
47
src/core/operations/Sleep.mjs
Normal file
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import Operation from "../Operation";
|
||||
|
||||
/**
|
||||
* Sleep operation
|
||||
*/
|
||||
class Sleep extends Operation {
|
||||
|
||||
/**
|
||||
* Sleep constructor
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.name = "Sleep";
|
||||
this.module = "Default";
|
||||
this.description = "Sleep causes the recipe to wait for a specified number of milliseconds before continuing execution.";
|
||||
this.inputType = "ArrayBuffer";
|
||||
this.outputType = "ArrayBuffer";
|
||||
this.args = [
|
||||
{
|
||||
"name": "Time (ms)",
|
||||
"type": "number",
|
||||
"value": 1000
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {ArrayBuffer} input
|
||||
* @param {Object[]} args
|
||||
* @returns {ArrayBuffer}
|
||||
*/
|
||||
async run(input, args) {
|
||||
const ms = args[0];
|
||||
await new Promise(r => setTimeout(r, ms));
|
||||
return input;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default Sleep;
|
Loading…
Add table
Add a link
Reference in a new issue