harmony 鸿蒙LoopObserver
LoopObserver
The LoopObserver module defines an observer to listen for event processing timeout. It can be used as an input parameter in ErrorManager.on to listen for the event processing timeout of the current application’s main thread.
NOTE
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.
Modules to Import
import { errorManager } from '@kit.AbilityKit';
LoopObserver.onLoopTimeOut
onLoopTimeOut?(timeout: number): void
Called when a timeout occurs for the main thread to process an event in the JS runtime.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Ability.AbilityRuntime.Core
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
timeout | number | Yes | Actual execution time of the main thread. |
Example
import { errorManager } from '@kit.AbilityKit';
let observer: errorManager.LoopObserver = {
onLoopTimeOut(timeout: number) {
console.log('Duration timeout: ' + timeout);
}
};
errorManager.on("loopObserver", 1, observer);
你可能感兴趣的鸿蒙文章
harmony 鸿蒙AbilityAccessControl
harmony 鸿蒙OH_NativeBundle_ApplicationInfo
harmony 鸿蒙OH_NativeBundle_ElementName
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦