Web3JS Online
Viem Online
Webhooks, Alerts, and a simple API.
The pollTillDefined function is a utility method provided by the web3.utils module that repeatedly calls an asynchronous function with a given interval until the result of the function is defined (not undefined or null), or until a timeout is reached. The function takes two parameters: func and interval.
The func parameter is an asynchronous function of type {AsyncFunction
The interval parameter is a number that represents the interval in milliseconds between each call to the func function.
The pollTillDefined function returns a {Promise
It's important to note that the pollTillDefined function will be deprecated in the next major release, and the pollTillDefinedAndReturnIntervalId function should be used instead. The pollTillDefinedAndReturnIntervalId function provides the same functionality as pollTillDefined, but it also returns the interval ID, which can be used to stop the polling.
Here's an example of how the pollTillDefined function can be used:
In this example, the pollTillDefined function is called with an asynchronous function that performs some asynchronous operation and returns the result. The interval parameter is set to 1000, which means that the function will be called every 1000 milliseconds until the result is defined. Once the result is defined, the pollTillDefined function resolves to the result.