Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
benlau committed Jul 16, 2015
1 parent 82ab452 commit a66cfeb
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,20 @@ Given an array of promises , it will create a promise object that will be fulfil

Given an array of promises , it will create a promise object that will be fulfilled once all the input promises are fulfilled. And it will be rejected if any one of the input promises is rejected. It won't change the state until all the input promises are settled.

Advanced Usage
==============

1. Resolve by multiple signals.
-------------------------------


```
Promise {
resolveWhen: Q.all([timer.triggered, loader.loaded]);
}
```



32 changes: 32 additions & 0 deletions tests/unittests/tst_promise_resolvewhen_all_signal.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import QtQuick 2.0
import QtTest 1.0
import QuickPromise 1.0

TestSuite {
name : "Promise_ResolveWhen_Signal_All"

Promise {
id : promise
signal triggered1
signal triggered2
resolveWhen: Q.all([promise.triggered1,promise.triggered2])
}

function test_resolve() {
compare(promise.isSettled,false);
tick();
compare(promise.isSettled,false);

promise.triggered1();
compare(promise.isSettled,false);
tick();
compare(promise.isSettled,false);

promise.triggered2();
compare(promise.isSettled,false);

tick();
compare(promise.isSettled,true);
}
}

3 changes: 2 additions & 1 deletion tests/unittests/unittests.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ DISTFILES += \
tst_promisejs_all_signal.qml \
tst_promisejs_all_promise_item.qml \
tst_promise_resolvewhen_promise.qml \
TestSuite.qml
TestSuite.qml \
tst_promise_resolvewhen_all_signal.qml

0 comments on commit a66cfeb

Please sign in to comment.