JavaScript set_time_limit function

A JavaScript equivalent of PHP’s set_time_limit
function set_time_limit (seconds) {
  // http://kevin.vanzonneveld.net
  // +   original by: Brett Zamir (http://brett-zamir.me)
  // *     example 1: set_time_limit(4);
  // *     returns 1: undefined

  // BEGIN REDUNDANT
  this.php_js = this.php_js || {};
  // END REDUNDANT

  this.window.setTimeout(function () {
    if (!this.php_js.timeoutStatus) {
      this.php_js.timeoutStatus = true;
    }
    throw 'Maximum execution time exceeded';
  }, seconds * 1000);
}

Example 1
set_time_limit(4);

Should return
undefined
Теги:
set_time_limit
Добавлено: 26 Июля 2018 21:34:59 Добавил: Андрей Ковальчук Нравится 0
Добавить
Комментарии:
Нету комментариев для вывода...