diff options
Diffstat (limited to 'src/qmlmodels/doc/snippets/qml/listmodel/dataloader.mjs')
-rw-r--r-- | src/qmlmodels/doc/snippets/qml/listmodel/dataloader.mjs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qmlmodels/doc/snippets/qml/listmodel/dataloader.mjs b/src/qmlmodels/doc/snippets/qml/listmodel/dataloader.mjs new file mode 100644 index 0000000000..eed1bca6f1 --- /dev/null +++ b/src/qmlmodels/doc/snippets/qml/listmodel/dataloader.mjs @@ -0,0 +1,13 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +// ![0] +WorkerScript.onMessage = function(msg) { + if (msg.action == 'appendCurrentTime') { + var data = {'time': new Date().toTimeString()}; + msg.model.append(data); + msg.model.sync(); // updates the changes to the list + } +} +// ![0] + |