UNPKG

locutus

Version:

Locutus other languages' standard libraries to JavaScript for fun and educational purposes

18 lines (17 loc) 735 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.set_time_limit = set_time_limit; const _phpRuntimeState_ts_1 = require("../_helpers/_phpRuntimeState.js"); function set_time_limit(seconds) { // discuss at: https://locutus.io/php/set_time_limit/ // original by: Brett Zamir (https://brett-zamir.me) // test: skip-all // example 1: set_time_limit(4) // returns 1: undefined setTimeout(function () { if (!(0, _phpRuntimeState_ts_1.getPhpRuntimeBoolean)('timeoutStatus', false)) { (0, _phpRuntimeState_ts_1.setPhpRuntimeEntry)('timeoutStatus', true); } throw new Error('Maximum execution time exceeded'); }, seconds * 1000); }