Skip to content

Commit 2f80667

Browse files
committed
site: actions tutorial: destroy is not required (#2776)
1 parent a6c05ed commit 2f80667

File tree

1 file changed

+1
-2
lines changed
  • site/content/tutorial/12-actions/01-actions

1 file changed

+1
-2
lines changed

site/content/tutorial/12-actions/01-actions/text.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { pannable } from './pannable.js';
2727
></div>
2828
```
2929

30-
Open the `pannable.js` file. Like transition functions, an action function receives a `node` and some optional parameters, and returns an action object. That object must have a `destroy` function, which is called when the element is unmounted.
30+
Open the `pannable.js` file. Like transition functions, an action function receives a `node` and some optional parameters, and returns an action object. That object can have a `destroy` function, which is called when the element is unmounted.
3131

3232
We want to fire `panstart` event when the user mouses down on the element, `panmove` events (with `dx` and `dy` properties showing how far the mouse moved) when they drag it, and `panend` events when they mouse up. One possible implementation looks like this:
3333

@@ -84,4 +84,3 @@ export function pannable(node) {
8484
Update the `pannable` function and try moving the box around.
8585

8686
> This implementation is for demonstration purposes — a more complete one would also consider touch events.
87-

0 commit comments

Comments
 (0)