-
Notifications
You must be signed in to change notification settings - Fork 85
Understanding QML Javascript for Web Developers
Sathya Prasad edited this page Mar 23, 2016
·
1 revision
Refer to these links first its an excellent read :
- http://doc.qt.io/qt-5/qtqml-javascript-expressions.html
- http://doc.qt.io/qt-5/qtqml-javascript-hostenvironment.html
Few points to note:
- There is no window or document object
- No global properties can be defined: all variables and functions must be locally defined, and belong to their local scope
- Due to the different environments, JavaScript frameworks intended for the Web are usually not compatible with QML
- The setTimeout() and setInterval() JavaScript functions are not supported: use Timer elements instead
- The XMLHttpRequest object is supported, and can be used to retrieve data from the network. There is no cross-domain issue. However AppFramework provides NetworkObject which is much richer and easy to use.
- JavaScript code cannot modify the global object. In QML, the global object is constant - existing properties cannot be modified or deleted, and no new properties may be created.
- Javascript patterns such as "Promises" or "Callbacks" can be re-created in QML since these were provided by third-party libraries.
Good References: