Snip
|
At their most basic, promises are a bit like event liste...
|
---|
Categories |
|
---|
For Snip |
loading snip actions ... |
---|---|
For Page |
loading url actions ... |
At their most basic, promises are a bit like event listeners except:
This is extremely useful for async success/failure, because you're less interested in the exact time something became available, and more interested in reacting to the outcome.
HTML |
<p>At their most basic, promises are a bit like event listeners except:</p> <ul> <li>A promise can only succeed or fail once. It cannot succeed or fail twice, neither can it switch from success to failure or vice versa</li> <li>If a promise has succeeded or failed and you later add a success/failure callback, the correct callback will be called, even though the event took place earlier</li> </ul> <p>This is extremely useful for async success/failure, because you're less interested in the exact time something became available, and more interested in reacting to the outcome.</p> |
---|