import pDefer from 'p-defer'; function delay(milliseconds) { const deferred = pDefer(); setTimeout(deferred.resolve, milliseconds, '🦄'); return deferred.promise; } console.log(await delay(100)); //=> '🦄'
Returns an object
with a promise
property and functions to resolve()
and reject()
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4