diff --git a/lib/Examples.md b/lib/Examples.md
index 82a856b..06e1ef6 100644
--- a/lib/Examples.md
+++ b/lib/Examples.md
@@ -52,9 +52,9 @@ end
## Cancellable animation sequence
The following is an example of an animation sequence which is composable and cancellable. If the sequence is cancelled, the animated part will instantly jump to the end position as if it had played all the way through.
-We use , which uses `finally` internally, instead of `andThen` because we want the Promises to run even if the Promise is cancelled. We handle the case of the Promise being cancelled with the `onCancel` function.
+We use , which uses `done` internally, instead of `andThen` because we want the Promises to run even if the Promise is cancelled. We handle the case of the Promise being cancelled with the `onCancel` function.
-We take advantage of Promise chaining by returning Promises from the `finally` handler functions. Because of this behavior, cancelling the final Promise in the chain will propagate up to the very top and cancel every single Promise you see here.
+We take advantage of Promise chaining by returning Promises from the `done` handler functions. Because of this behavior, cancelling the final Promise in the chain will propagate up to the very top and cancel every single Promise you see here.
```lua
local Promise = require(game.ReplicatedStorage.Promise)
@@ -84,13 +84,13 @@ end
local function runAnimation(part, intensity)
return Promise.resolve()
- :finallyCall(sleep, 1))
- :finallyCall(runTween, part, {
+ :doneCall(sleep, 1)
+ :doneCall(runTween, part, {
Reflectance = 1 * intensity
- }):finallyCall(runTween, part, {
+ }):doneCall(runTween, part, {
CFrame = CFrame.new(part.Position) *
CFrame.Angles(0, math.rad(90 * intensity), 0)
- }):finallyCall(runTween, part, {
+ }):doneCall(runTween, part, {
Size = (
Vector3.new(10, 10, 10) * intensity
) + Vector3.new(1, 1, 1)
@@ -98,9 +98,10 @@ local function runAnimation(part, intensity)
end
local animation = Promise.resolve() -- Begin Promise chain
- :finallyCall(runAnimation, workspace.Part, 1)
- :finallyCall(sleep, 1)
- :finallyCall(runAnimation, workspace.Part, 0)
+ :doneCall(runAnimation, workspace.Part, 1)
+ :doneCall(sleep, 1)
+ :doneCall(runAnimation, workspace.Part, 0)
+ :catch(warn)
wait(2)
animation:cancel() -- Remove this line to see the full animation
diff --git a/lib/README.md b/lib/README.md
index 6753b45..8e90c2b 100644
--- a/lib/README.md
+++ b/lib/README.md
@@ -366,8 +366,12 @@ docs:
desc: |
Set a handler that will be called only if the Promise resolves or is cancelled. This method is similar to `finally`, except it doesn't catch rejections.
+ ::: tip
+ `done` should be reserved specifically when you want to perform some operation after the Promise is finished (like `finally`), but you don't want to consume rejections (like in this example). You should use `andThen` instead if you only care about the Resolved case.
+ :::
+
::: warning
- If this Promise is cancelled, any Promises chained off of it with `andThen` won't run. Only Promises chained with `done` and `finally` will run in the case of cancellation.
+ Like `finally`, if the Promise is cancelled, any Promises chained off of it with `andThen` won't run. Only Promises chained with `done` and `finally` will run in the case of cancellation.
:::
Returns a new promise chained from this promise.