# elapsed

The `elapsed` function is meant to execute a callback function if a promise hasn't been resolved within the specified amount of time (milliseconds). A practical use case for this would be for an asynchronous task that is intermittently slow, and you want to display an activity indicator if that tasks is taking a measurable amount of time to finish. In cases when action takes less the specified amount of time, an activity indicator would not need to be shown.

### Basic Example

In this example the elapsed time is 2 seconds, and then the activity indicator will show if the timer isn't stopped or rejected.

The promise was rejected! The time has elapsed! Start Timer Stop Timer Reject Promise