forked from sveltejs/svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix destructuring to get multiple stores (sveltejs#5390)
- Loading branch information
1 parent
d6487d2
commit 0f25fc3
Showing
10 changed files
with
71 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/runtime/samples/reactive-assignment-in-complex-declaration-with-store/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
html: `<h1>2 2 xxx 5 6</h1>` | ||
}; |
16 changes: 16 additions & 0 deletions
16
test/runtime/samples/reactive-assignment-in-complex-declaration-with-store/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<script> | ||
import { writable } from 'svelte/store'; | ||
let eid = writable(1); | ||
let foo; | ||
let u; | ||
let v; | ||
let w; | ||
[u, v, w] = [ | ||
{id: eid = writable(foo = 2), name: 'xxx'}, | ||
5, | ||
writable(6) | ||
]; | ||
</script> | ||
|
||
<h1>{foo} {$eid} {u.name} {v} {$w}</h1> |
3 changes: 3 additions & 0 deletions
3
test/runtime/samples/reactive-assignment-in-declaration/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
<script> | ||
let foo; | ||
let bar = (foo = 1); | ||
function a() { | ||
bar = (foo = 1); | ||
} | ||
</script> | ||
|
||
<h1>{foo} {bar}</h1> |
15 changes: 10 additions & 5 deletions
15
test/runtime/samples/reactive-assignment-in-for-loop-head/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
<script> | ||
let foo1; | ||
let foo2; | ||
for (let bar = (foo1 = 0); bar < 5; bar += 1) { | ||
foo2 = foo1; | ||
} | ||
let foo1; | ||
let foo2; | ||
for (let bar = (foo1 = 0); bar < 5; bar += 1) { | ||
foo2 = foo1; | ||
} | ||
function a() { | ||
for (let bar = (foo1 = 0); bar < 5; bar += 1) { | ||
foo2 = foo1; | ||
} | ||
} | ||
</script> | ||
|
||
<h1>{foo1} {foo2}</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
html: `31 42` | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<script> | ||
import { writable } from 'svelte/store'; | ||
const context = { | ||
store1: writable(31), | ||
store2: writable(42) | ||
}; | ||
let store1; | ||
let store2; | ||
({ | ||
store1, | ||
store2 | ||
} = context); | ||
</script> | ||
|
||
{$store1} | ||
{$store2} |