Document the arg() function QML adds to the String prototype.
[profile/ivi/qtdeclarative.git] / src / qml / doc / src / javascript / hostenvironment.qdoc
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the documentation of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:FDL$
9 ** GNU Free Documentation License
10 ** Alternatively, this file may be used under the terms of the GNU Free
11 ** Documentation License version 1.3 as published by the Free Software
12 ** Foundation and appearing in the file included in the packaging of
13 ** this file.
14 **
15 ** Other Usage
16 ** Alternatively, this file may be used in accordance with the terms
17 ** and conditions contained in a signed written agreement between you
18 ** and Nokia.
19 **
20 **
21 **
22 **
23 **
24 ** $QT_END_LICENSE$
25 **
26 ****************************************************************************/
27 /*!
28 \page qtqml-javascript-hostenvironment.html
29 \title JavaScript Host Environment
30 \brief Description of the JavaScript host environment provided by the QML engine
31
32
33 QML provides a JavaScript host environment tailored to writing QML applications.
34 This environment is different from the host environment provided by a browser
35 or a server-side JavaScript environment such as Node.js. For example, QML does
36 not provide a \c window object or \c{DOM API} as commonly found in a browser environment.
37
38 \section1 Common Base
39
40 Like a browser or server-side JavaScript environment, the QML runtime implements the
41 \l{ECMA-262}{ECMAScript Language Specification} standard. This provides access to
42 all of the built-in types and functions defined by the standard, such as Object, Array, and Math.
43 The QML runtime implements the 5th edition of the standard, which is the same edition commonly
44 implemented by browsers.
45
46 The standard ECMAScript built-ins are not explicitly documented in the QML documentation. For more
47 information on their use, please refer to the ECMA-262 5th edition standard or one of the many online
48 JavaScript reference and tutorial sites, such as the \l{W3Schools JavaScript Reference} (JavaScript Objects
49 Reference section). Many sites focus on JavaScript in the browser, so in some cases you may need to double
50 check the specification to determine whether a given function or object is part of standard ECMAScript or
51 specific to the browser environment. In the case of the W3Schools link above, the \c{JavaScript Objects
52 Reference} section generally covers the standard, while the \c{Browser Objects Reference} and \c{HTML DOM
53 Objects Reference} sections are browser specific (and thus not applicable to QML).
54
55 \section1 Host Objects and Functions
56
57 The QML JavaScript host environment implements a number of host objects and functions, as
58 detailed in the \l{QML Global Object} documentation.
59
60
61 \section1 Native Object Modification
62
63 QML makes the following modifications to native objects:
64
65 \list
66 \li An \l {String::arg}{arg()} function is added to the \l String prototype.
67 \li Locale-aware coversion functions are added to the \l Date and \l Number prototypes.
68 \endlist
69
70 \section1 Restrictions
71
72 QML implements the following restrictions for JavaScript code:
73
74 \list
75 \li JavaScript code cannot modify the global object.
76 \li Global code is run in a reduced scope.
77 \li The value of \c this is undefined in QML in the majority of contexts.
78 \endlist
79
80 See \l {QML JavaScript Restrictions} for more details on these restrictions.
81
82
83 */