aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/threading/threadedlistmodel/dataloader.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/threading/threadedlistmodel/dataloader.mjs')
-rw-r--r--tests/manual/threading/threadedlistmodel/dataloader.mjs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/manual/threading/threadedlistmodel/dataloader.mjs b/tests/manual/threading/threadedlistmodel/dataloader.mjs
new file mode 100644
index 0000000000..2c436d34dc
--- /dev/null
+++ b/tests/manual/threading/threadedlistmodel/dataloader.mjs
@@ -0,0 +1,12 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+// ![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]