summaryrefslogtreecommitdiff
path: root/node_modules/core-js/library/modules/core.delay.js
blob: 3e19ef3909e2f52c939e4312d46249c4867ca309 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
var global  = require('./$.global')
  , core    = require('./$.core')
  , $export = require('./$.export')
  , partial = require('./$.partial');
// https://esdiscuss.org/topic/promise-returning-delay-function
$export($export.G + $export.F, {
  delay: function delay(time){
    return new (core.Promise || global.Promise)(function(resolve){
      setTimeout(partial.call(resolve, true), time);
    });
  }
});