\section2 Example One: Automatic Release
In the following example, the scarce resource will be automatically released
-after the binding evaluation is complete.
+after the binding evaluation is complete. Assume we have the following qml file:
\snippet qml/integrating-javascript/scarceresources/exampleOne.qml 0
+And then use it from C++:
+
\snippet qml/integrating-javascript/scarceresources/avatarExample.cpp 1
\section2 Example Two: Automatic Release Prevented By Reference
\snippet qml/integrating-javascript/scarceresources/exampleTwo.qml 0
+And from C++:
+
\snippet qml/integrating-javascript/scarceresources/avatarExample.cpp 2
\section2 Example Three: Explicit Preservation
to prevent the declarative engine from automatically releasing the
resource after evaluation of the imported script.
+We create a JavaScript file:
\snippet qml/integrating-javascript/scarceresources/exampleThree.js 0
+Import it in QML:
\snippet qml/integrating-javascript/scarceresources/exampleThree.qml 0
+Run it in C++:
\snippet qml/integrating-javascript/scarceresources/avatarExample.cpp 3
\section2 Example Four: Explicit Destruction
resources by releasing the scarce resource held in a JavaScript object, if
required, during evaluation of a JavaScript expression.
+We create a JavaScript file:
\snippet qml/integrating-javascript/scarceresources/exampleFour.js 0
+Import it in QML:
\snippet qml/integrating-javascript/scarceresources/exampleFour.qml 0
+Run it in C++:
\snippet qml/integrating-javascript/scarceresources/avatarExample.cpp 4
\section2 Example Five: Explicit Destruction and JavaScript References
of those references (to explicitly release the scarce resource), all of
the references will be affected.
+
\snippet qml/integrating-javascript/scarceresources/exampleFive.qml 0
+Run it in C++:
\snippet qml/integrating-javascript/scarceresources/avatarExample.cpp 5
*/