Returns a Promise, which will resolve after timeout. For example, await delay(1000)
will resolve after 1 second. This function does not block the thread/event loop.
timeout, if less than or equal to 0, then the function returns a Promise that resolves immediately.
TypeScript decorator, which cannot be used in JavaScript.
Decorates class's getter properties, and the decorated properties will be automatically executed and saved the value on the first call, and then use the saved value on subsequent calls.
Creates a Promise, which is similar to new Promise
, but it will keep the engine running when the Promise is in the pending state (before resolve/reject).
Because nodejs does not know the asynchronous behavior of Java APIs, this function is usually used to create a Promise for a Java API, and keep the engine running until the Java API returns.
lang provides language-related API, such as
delay
.