Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QHarmonyJsObjectRef Class Reference

\inmodule QtCore More...

Collaboration diagram for QHarmonyJsObjectRef:

(Note that these are not member symbols.)

size_t qHash (const QHarmonyJsObjectRef &key, size_t seed) noexcept
 Returns the hash value for key, using seed to seed the calculation.

Detailed Description

\inmodule QtCore

The QHarmonyJsObjectRef class keeps a JS object of a HarmonyOS application alive and lets other threads hold a reference to it.

\reentrant

A napi_value is valid only on the JS thread, and only until the task or callback that obtained it returns. A QHarmonyJsObjectRef holds a strong reference to the object instead. You can copy, store, and compare it on any thread. On the JS thread, value() returns the object again.

The reference is released when the last copy is destroyed, on whichever thread that happens. The release itself runs asynchronously on the JS thread, so the JS object may outlive the last copy for a short time.

Two references compare equal when they refer to the same JS object, even if they were created independently.

See also
{Qt for HarmonyOS Platform API}

◆ qHash()

size_t qHash ( const QHarmonyJsObjectRef & key,
size_t seed )
related

Returns the hash value for key, using seed to seed the calculation.

References that compare equal have the same hash value. You can call this function on any thread.

Definition at line 182 of file qharmonyjsobjectref.cpp.


The documentation for this class was generated from the following file: