diff --git a/src/delay/index.ts b/src/delay/index.ts new file mode 100644 index 0000000..4521bab --- /dev/null +++ b/src/delay/index.ts @@ -0,0 +1,17 @@ +'use strict'; + +/** + * Delay in an async/await function + * + * @param {integer} ms Milliseconds to delay for + * + * @returns {Promise} Promise to resolve after timeout + **/ + +function delay (ms : number) { + return new Promise((resolve : any) => { + return setTimeout(resolve, ms); + }); +} + +module.exports.delay = delay; \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..9814b07 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "esModuleInterop": true, + "target": "ES2017", + "noImplicitAny": true, + "moduleResolution": "node", + "sourceMap": true, + "removeComments" : false, + "baseUrl" : "lib", + "outDir": "./lib/", + "rootDir" : "./src/", + "paths" : { + "log" : ["./lib/log"] + } + }, + "exclude" : [ + "./app", + "./node_modules", + "./experiments", + "./test" + ] +} \ No newline at end of file