@@ -5,10 +5,6 @@ import { on_destroy } from './index.js';
5
5
export var current_component = null ;
6
6
7
7
/**
8
- * Retrieves the context that belongs to the closest parent component with the specified `key`.
9
- * Must be called during component initialisation.
10
- *
11
- * https://svelte.dev/docs/svelte#getcontext
12
8
* @template T
13
9
* @param {any } key
14
10
* @returns {T }
@@ -21,13 +17,6 @@ export function getContext(key) {
21
17
}
22
18
23
19
/**
24
- * Associates an arbitrary `context` object with the current component and the specified `key`
25
- * and returns that object. The context is then available to children of the component
26
- * (including slotted content) with `getContext`.
27
- *
28
- * Like lifecycle functions, this must be called during component initialisation.
29
- *
30
- * https://svelte.dev/docs/svelte#setcontext
31
20
* @template T
32
21
* @param {any } key
33
22
* @param {T } context
@@ -39,25 +28,14 @@ export function setContext(key, context) {
39
28
}
40
29
41
30
/**
42
- * Checks whether a given `key` has been set in the context of a parent component.
43
- * Must be called during component initialisation.
44
- *
45
- * https://svelte.dev/docs/svelte#hascontext
46
31
* @param {any } key
47
32
* @returns {boolean }
48
33
*/
49
34
export function hasContext ( key ) {
50
35
return getAllContexts ( ) . has ( key ) ;
51
36
}
52
37
53
- /**
54
- * Retrieves the whole context map that belongs to the closest parent component.
55
- * Must be called during component initialisation. Useful, for example, if you
56
- * programmatically create a component and want to pass the existing context to it.
57
- *
58
- * https://svelte.dev/docs/svelte#getallcontexts
59
- * @returns {Map<any, any> }
60
- */
38
+ /** @returns {Map<any, any> } */
61
39
export function getAllContexts ( ) {
62
40
const context = current_component ;
63
41
@@ -72,11 +50,7 @@ export function getAllContexts() {
72
50
}
73
51
74
52
export function push ( ) {
75
- current_component = {
76
- p : current_component ,
77
- c : null ,
78
- d : null
79
- } ;
53
+ current_component = { p : current_component , c : null , d : null } ;
80
54
}
81
55
82
56
export function pop ( ) {
0 commit comments