1# LoopObserver 2 3The LoopObserver module defines an observer to listen for event processing timeout. It can be used as an input parameter in [ErrorManager.on](./js-apis-app-ability-errorManager.md#errormanageronerror) to listen for the event processing timeout of the current application's main thread. 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 12. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8 9## Modules to Import 10 11```ts 12import { errorManager } from '@kit.AbilityKit'; 13``` 14 15## LoopObserver.onLoopTimeOut 16 17onLoopTimeOut?(timeout: number): void 18 19Called when a timeout occurs for the main thread to process an event in the JS runtime. 20 21**Atomic service API**: This API can be used in atomic services since API version 12. 22 23**System capability**: SystemCapability.Ability.AbilityRuntime.Core 24 25**Parameters** 26 27| Name| Type| Mandatory| Description| 28| -------- | -------- | -------- | -------- | 29| timeout | number | Yes| Actual execution time of the main thread.| 30 31**Example** 32 33```ts 34import { errorManager } from '@kit.AbilityKit'; 35 36let observer: errorManager.LoopObserver = { 37 onLoopTimeOut(timeout: number) { 38 console.log('Duration timeout: ' + timeout); 39 } 40}; 41 42errorManager.on("loopObserver", 1, observer); 43``` 44