1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
4\page qtqml-javascript-topic.html
5\title Integrating QML and JavaScript
6\brief Description of how to use JavaScript in QML applications
8The QML language uses a JSON-like syntax and allows various expressions and
9methods to be defined as JavaScript functions. It also allows users to import
10JavaScript files and use the functionality those imports provide.
12This allows developers and designers to leverage the knowledge they have of
13JavaScript to quickly develop both user-interfaces and application logic.
15\section1 JavaScript Expressions
17QML has a deep JavaScript integration, and allows \l{Signal Attributes}
18{signal handlers} and \l{Method Attributes}{methods} to be defined in JavaScript.
19Another core feature of QML is the ability to specify and enforce relationships
20between object properties using \l{Property Binding}{property bindings}, which
21are also defined using JavaScript.
23See the documentation page titled
24\l{qtqml-javascript-expressions.html}{JavaScript Expressions in QML Documents}
25for more information about using JavaScript expressions in QML.
27\section1 JavaScript Resources
29Application logic defined in JavaScript functions may be separated into
30separate JavaScript files known as JavaScript resources. There are several
31different kinds of JavaScript resources, with different semantics.
33See the documentation page titled \l{qtqml-javascript-resources.html}
34{Defining JavaScript Resources In QML} for more information about defining JavaScript
37\section1 JavaScript Imports
39A QML document may import JavaScript resources, and JavaScript resources may
40import other JavaScript resources as well as QML modules. This allows an
41application developer to provide application logic in modular, self-contained
44See the documentation page titled
45\l{qtqml-javascript-imports.html}{Importing JavaScript Resources}
46for more information on how to import JavaScript resources and how to use the
47functionality they provide.
49\section1 JavaScript Host Environment
51The QML engine provides a JavaScript environment that has some differences to
52the JavaScript environment provided by a web browser. Certain limitations
53apply to code running in the environment, and the QML engine provides various
54objects in the root context which may be unfamiliar to JavaScript developers.
56These limitations and extensions are documented in the description of the
57\l{qtqml-javascript-hostenvironment.html}{JavaScript Host Environment} provided
60There is also an in depth description of the
61\l{qtqml-javascript-memory.html}{memory management} employed by the JavaScript
64\section1 Configuring the JavaScript engine
66For specific use cases you may want to override some of the parameters the
67JavaScript engine uses for handling memory and compiling JavaScript. See
68\l{qtqml-javascript-finetuning.html}{Configuring the JavaScript engine} for
69more information on these parameters.