/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: http://www.gnu.org/copyleft/fdl.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page qtqml-javascript-topic.html \title Integrating QML and JavaScript \brief Description of how to use JavaScript in QML applications The QML language uses a JSON-like syntax and allows various expressions and methods to be defined as JavaScript functions. It also allows users to import JavaScript files and use the functionality those imports provide. This allows developers and designers to leverage the knowledge they have of JavaScript to quickly develop both user-interfaces and application logic. \section1 JavaScript Expressions QML has a deep JavaScript integration, and allows \l{Signal Attributes} {signal handlers} and \l{Method Attributes}{methods} to be defined in JavaScript. Another core feature of QML is the ability to specify and enforce relationships between object properties using \l{Property Binding}{property bindings}, which are also defined using JavaScript. See the documentation page titled \l{qtqml-javascript-expressions.html}{JavaScript Expressions in QML Documents} for more information about using JavaScript expressions in QML. \section1 JavaScript Resources Application logic defined in JavaScript functions may be separated into separate JavaScript files known as JavaScript resources. There are several different kinds of JavaScript resources, with different semantics. See the documentation page titled \l{qtqml-javascript-resources.html} {Defining JavaScript Resources In QML} for more information about defining JavaScript resources for QML. \section1 JavaScript Imports A QML document may import JavaScript resources, and JavaScript resources may import other JavaScript resources as well as QML modules. This allows an application developer to provide application logic in modular, self-contained files. See the documentation page titled \l{qtqml-javascript-imports.html}{Importing JavaScript Resources} for more information on how to import JavaScript resources and how to use the functionality they provide. \section1 JavaScript Host Environment The QML engine provides a JavaScript environment that has some differences to the JavaScript environment provided by a web browser. Certain limitations apply to code running in the environment, and the QML engine provides various objects in the root context which may be unfamiliar to JavaScript developers. These limitations and extensions are documented in the description of the \l{qtqml-javascript-hostenvironment.html}{JavaScript Host Environment} provided by the QML engine. */