![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
Native interface to a core application on HarmonyOS. More...
Native interface to a core application on HarmonyOS.
Accessed through QCoreApplication::nativeInterface().
On HarmonyOS, the ArkTS runtime and the platform APIs run on the main thread of the process, called the JS thread. The Qt application runs on a separate thread, called the Qt thread. This is the thread of the QCoreApplication object. This interface runs application code on the JS thread, where the code receives a QHarmonyJsContext. It also brings results back to the Qt thread.
Code that runs on the JS thread must follow these rules: \list
napi_value that it obtains is valid until the task returns, and must not leave the JS thread. To keep a JS object longer, use a QHarmonyJsObjectRef. Each task runs inside its own Node-API handle scope. A C++ exception that a task throws and a JS exception that it leaves pending are caught and logged on the JS thread. A task that needs to react to a failure must handle it itself.
\inmodule QtCore \inheaderfile QCoreApplication