decktape/libs/promise.js
2017-08-25 15:18:07 +02:00

13 lines
283 B
JavaScript

'use strict';
module.exports.delay = delay => value =>
new Promise(resolve => setTimeout(resolve, delay, value));
module.exports.value = value => () => value;
module.exports.wait = ms => () => module.exports.delay(ms);
module.exports.call = f => val => {
f(); return val;
};