$ curl cheat.sh/
/*
 * Define the function in your root-node (`ApplicationWindow`).
 * This will be the last place, QML will look for a name, before it
 * resorts to the `C++`-context properties.
 * 
 * See [**here**](http://doc.qt.io/qt-5/qtqml-documents-scope.html) to
 * find out, how the names of variables and functions are resolved in
 * QML.
 * 
 * It is not possible however to [*modify the global
 * object*](http://doc.qt.io/qt-5/qtqml-javascript-
 * hostenvironment.html#javascript-environment-restrictions), so true
 * global JS-functions are not possible.
 * 
 * The more efficient approach however would be, to keep it always in one
 * of the moste specific scopes, so referencing it with
 * `Identifyer.function()` would be faster to look up. The singleton for
 * libraries however is not the way to go. Look
 * [**here**](http://doc.qt.io/qt-5/qtqml-javascript-resources.html) for
 * the usage of JS libraries.
 * 
 * [derM] [so/q/44044041] [cc by-sa 3.0]
 */

$
Follow @igor_chubin cheat.sh