@dx-libs/timeout
v0.1.1
Published
Yet another setTimeout wrapper function, but async.
Downloads
5
Readme
@dx-libs/timeout v0.1.0
Libreria de Timeout en @dx-libs/timeout
Scripts
npm run eslint
npm run test-watch
npm run test
npm run sonar
Instalación
Como libreria
npm install --save @dx-libs/timeout
Modo de uso
const timeout = require("@dx-libs/timeout");
timeout(() => { console.log('TIMEOUT !'); return 42; }, 1000)
.then((value) => {
console.log('CALLBACK!', value);
});
const t = timeout(() => { console.log('NEVER !!'); }, 2000)
.then((value) => {
console.log('CALLBACK CANCELED!', value);
});
t.cancel();