Skip to content

Commit ccc61a7

Browse files
authored
add missing export for hasContext (#5727)
1 parent 505eba8 commit ccc61a7

File tree

6 files changed

+41
-0
lines changed

6 files changed

+41
-0
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Svelte changelog
22

3+
## Unreleased
4+
5+
* Actually export `hasContext` ([#5726](https://github.com/sveltejs/svelte/issues/5726))
6+
37
## 3.30.0
48

59
* Add a typed `SvelteComponent` interface ([#5431](https://github.com/sveltejs/svelte/pull/5431))

src/runtime/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export {
77
afterUpdate,
88
setContext,
99
getContext,
10+
hasContext,
1011
tick,
1112
createEventDispatcher,
1213
SvelteComponentDev as SvelteComponent
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script>
2+
import { hasContext } from 'svelte';
3+
4+
const has = hasContext('test');
5+
</script>
6+
7+
<div>{has}</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script>
2+
import { setContext } from 'svelte';
3+
4+
export let value = '';
5+
6+
if (value) {
7+
setContext('test', value);
8+
}
9+
</script>
10+
11+
<slot></slot>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
html: `
3+
<div>true</div>
4+
<div>false</div>
5+
`
6+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<script>
2+
import Nested from "./Nested.svelte";
3+
import Leaf from "./Leaf.svelte";
4+
</script>
5+
6+
<Nested value="bar">
7+
<Leaf />
8+
</Nested>
9+
10+
<Nested>
11+
<Leaf />
12+
</Nested>

0 commit comments

Comments
 (0)