tests/auto/qml/qqmlpromise/data/promisechain.qml
raw| 1 | import QtQml 2.0 |
| 2 | |
| 3 | QtObject { |
| 4 | property int x: 0 |
| 5 | id: root; |
| 6 | Component.onCompleted: { |
| 7 | new Promise((res) => { |
| 8 | res(1) |
| 9 | }) |
| 10 | .then((data) => { |
| 11 | console.debug(data) |
| 12 | return new Promise((res) => {res(2)}); |
| 13 | }) |
| 14 | .then((data) => { |
| 15 | console.debug(data) |
| 16 | return new Promise((res) => {res(3)}); |
| 17 | }) |
| 18 | .then((data) => { |
| 19 | console.debug(data); |
| 20 | root.x = 42; |
| 21 | }); |
| 22 | } |
| 23 | |
| 24 | } |