diff options
Diffstat (limited to 'src/qml/doc/src/javascript/hostenvironment.qdoc')
-rw-r--r-- | src/qml/doc/src/javascript/hostenvironment.qdoc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qml/doc/src/javascript/hostenvironment.qdoc b/src/qml/doc/src/javascript/hostenvironment.qdoc index 3c3624f78d..d11e96df2b 100644 --- a/src/qml/doc/src/javascript/hostenvironment.qdoc +++ b/src/qml/doc/src/javascript/hostenvironment.qdoc @@ -74,6 +74,19 @@ Note that QML makes the following modifications to native objects: \li Locale-aware conversion functions are added to the \l Date and \l Number prototypes. \endlist +In addition, QML also extends the behavior of the instanceof function to +allow for type checking against QML types. This means that you may use it to +verify that a variable is indeed the type you expect, for example: + +\qml + var v = something(); + if (!v instanceof Item) { + throw new TypeError("I need an Item type!"); + } + + ... +\endqml + \section1 JavaScript Environment Restrictions |