Skip to content

Commit 831926b

Browse files
committed
Merge branch 'master' of github.com:sveltejs/svelte
2 parents 447ebf9 + 1ba4243 commit 831926b

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

site/content/docs/03-run-time.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,10 +573,14 @@ component.$on(event, callback)
573573

574574
Causes the `callback` function to be called whenever the component dispatches an `event`.
575575

576+
A function is returned that will remove the event listener when called.
577+
576578
```js
577-
app.$on('selected', event => {
579+
const off = app.$on('selected', event => {
578580
console.log(event.detail.selection);
579581
});
582+
583+
off();
580584
```
581585

582586
#### `$destroy`

site/content/tutorial/06-bindings/11-bind-this/text.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: This
33
---
44

5-
The readonly `this` binding applies to every element (and component) and allows to you obtain a reference to rendered elements. For example, we can get a reference to a `<canvas>` element:
5+
The readonly `this` binding applies to every element (and component) and allows you to obtain a reference to rendered elements. For example, we can get a reference to a `<canvas>` element:
66

77
```html
88
<canvas
@@ -12,4 +12,4 @@ The readonly `this` binding applies to every element (and component) and allows
1212
></canvas>
1313
```
1414

15-
Note that the value of `canvas` will be `undefined` until the component has mounted, so we put the logic inside the `onMount` [lifecycle function](tutorial/onmount).
15+
Note that the value of `canvas` will be `undefined` until the component has mounted, so we put the logic inside the `onMount` [lifecycle function](tutorial/onmount).

site/content/tutorial/10-transitions/07-local-transitions/text.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ title: Local transitions
44

55
Ordinarily, transitions will play on elements when any container block is added or destroyed. In the example here, toggling the visibility of the entire list also applies transitions to individual list elements.
66

7-
Instead, we'd like transitions to play only when individual items are added and removed — on other words, when the user drags the slider.
7+
Instead, we'd like transitions to play only when individual items are added and removed — in other words, when the user drags the slider.
88

99
We can achieve this with a *local* transition, which only plays when the immediate parent block is added or removed:
1010

1111
```html
1212
<div transition:slide|local>
1313
{item}
1414
</div>
15-
```
15+
```

site/src/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang='en' class="theme-default typo-default">
33
<head>
44
<meta charset='utf-8'>
5-
<meta name='viewport' content='width=device-width;initial-scale=1.0'>
5+
<meta name='viewport' content='width=device-width,initial-scale=1'>
66
<meta name='theme-color' content='#ff3e00'>
77

88
%sapper.base%

0 commit comments

Comments
 (0)