diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..eb49e78156 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.svelte linguist-language=HTML diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b38edb318..9419304783 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Svelte changelog +## 3.1.0 + +* Allow store subscribe functions to return an object with an `unsubscribe` method, providing native RxJS support ([#2549](https://github.com/sveltejs/svelte/issues/2549)) + ## 3.0.1 * Prevent text input cursor jumping in Safari ([#2506](https://github.com/sveltejs/svelte/issues/2506)) diff --git a/LICENSE b/LICENSE index 939579e8bd..b63fe48148 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016 [these people](https://github.com/sveltejs/svelte/graphs/contributors) +Copyright (c) 2016-19 [these people](https://github.com/sveltejs/svelte/graphs/contributors) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.md b/README.md index 605eee8fa8..96190a8c66 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ The source code for https://svelte.dev, including all the documentation, lives i ```bash cd site -npm install +npm install && npm run update npm run dev ``` diff --git a/package.json b/package.json index b1b5a5c3b4..85836aaa14 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "3.0.1", + "version": "3.1.0", "description": "Cybernetically enhanced web apps", "module": "index.mjs", "main": "index", diff --git a/site/content/docs/03-run-time.md b/site/content/docs/03-run-time.md index 843ac05e4c..0876cf3a36 100644 --- a/site/content/docs/03-run-time.md +++ b/site/content/docs/03-run-time.md @@ -573,10 +573,14 @@ component.$on(event, callback) Causes the `callback` function to be called whenever the component dispatches an `event`. +A function is returned that will remove the event listener when called. + ```js -app.$on('selected', event => { +const off = app.$on('selected', event => { console.log(event.detail.selection); }); + +off(); ``` #### `$destroy` diff --git a/site/content/tutorial/05-events/03-event-modifiers/text.md b/site/content/tutorial/05-events/03-event-modifiers/text.md index 05a2d8c5fb..73386dd096 100644 --- a/site/content/tutorial/05-events/03-event-modifiers/text.md +++ b/site/content/tutorial/05-events/03-event-modifiers/text.md @@ -18,10 +18,10 @@ DOM event handlers can have *modifiers* that alter their behaviour. For example, The full list of modifiers: -* `preventDefault` — calls `event.preventDefault()` before running the handler. Useful for e.g. client-side form handling +* `preventDefault` — calls `event.preventDefault()` before running the handler. Useful for client-side form handling, for example. * `stopPropagation` — calls `event.stopPropagation()`, preventing the event reaching the next element * `passive` — improves scrolling performance on touch/wheel events (Svelte will add it automatically where it's safe to do so) * `capture` — fires the handler during the *capture* phase instead of the *bubbling* phase ([MDN docs](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture)) * `once` — remove the handler after the first time it runs -You can chain modifiers together, e.g. `on:click|once|capture={...}`. \ No newline at end of file +You can chain modifiers together, e.g. `on:click|once|capture={...}`. diff --git a/site/content/tutorial/06-bindings/09-media-elements/text.md b/site/content/tutorial/06-bindings/09-media-elements/text.md index 32e7fa17b8..506eb25a4a 100644 --- a/site/content/tutorial/06-bindings/09-media-elements/text.md +++ b/site/content/tutorial/06-bindings/09-media-elements/text.md @@ -8,8 +8,8 @@ On line 116, add `currentTime={time}`, `duration` and `paused` bindings: ```html