Skip to content

Commit

Permalink
Firebase and Promises
Browse files Browse the repository at this point in the history
Refs #716
  • Loading branch information
mxcl committed Sep 29, 2017
1 parent 1da778b commit f27cc55
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Documentation/FAQ.md
Expand Up @@ -174,6 +174,30 @@ func foo() -> Promise<Any>
Who chooses when this promise starts? The answer is: Alamofire does and in this
case, it “starts” immediately when `foo()` is called.

## What is a good way to use Firebase with PromiseKit

There is no good way to use Firebase with PromiseKit. See the next question for rationale.

The best option is to embed your chain in your firebase handler:

```
foo.observe(.value) { snapshot in
firstly {
bar(with: snapshot)
}.then {
baz()
}.then {
baffle()
}.catch {
//…
}
}
```

## I need my `then` to fire multiple times

Then we’re afraid thgat you cannot use PromiseKit for that event. Promises only resolve `once`, this is the fundamental nature of promises and is considered a feature since it gives you guarantees about the flow of your chains.

## My question was not answered

[Please open a ticket](https://github.com/mxcl/PromiseKit/issues/new).

0 comments on commit f27cc55

Please sign in to comment.