decktape/libs/promise.js

13 lines
283 B
JavaScript
Raw Normal View History

2017-08-21 23:56:27 +03:00
'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;
};