summaryrefslogtreecommitdiff
path: root/node_modules/locutus/php/info/set_time_limit.js
blob: 63422eb534be76d2977b8ca6c56ba87c70dc2edb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'use strict';

module.exports = function set_time_limit(seconds) {
  // eslint-disable-line camelcase
  //  discuss at: http://locutus.io/php/set_time_limit/
  // original by: Brett Zamir (http://brett-zamir.me)
  //        test: skip-all
  //   example 1: set_time_limit(4)
  //   returns 1: undefined

  var $global = typeof window !== 'undefined' ? window : global;
  $global.$locutus = $global.$locutus || {};
  var $locutus = $global.$locutus;
  $locutus.php = $locutus.php || {};

  setTimeout(function () {
    if (!$locutus.php.timeoutStatus) {
      $locutus.php.timeoutStatus = true;
    }
    throw new Error('Maximum execution time exceeded');
  }, seconds * 1000);
};
//# sourceMappingURL=set_time_limit.js.map