Script.Timeout

Overview

Executes the given callback function at maximum in the given milliseconds.

( "null" | object ) myScript.Timeout(fn: () => void, milliseconds: number)

Arguments

() => void fn

The callback to execute.

number milliseconds

The maximum milliseconds to execute the callback.

Remarks

When function completed in the given milliseconds, the function returns the callback result, otherwise returns null.

Example

var result = Script.Timeout(function() { // Endless loop while(true) {}; }, 1000);

Copyright © 2010 - 2023 Emakin. All rights reserved.