mirror of https://github.com/sveltejs/svelte
parent
10bd29a258
commit
8a7ae2e89f
@ -1,15 +0,0 @@
|
||||
export class PortalKey {
|
||||
/** @param {string} name */
|
||||
constructor(name) {
|
||||
this.v = name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for use with `{#portal ...}` and `{@portal ...}`. It connects the portal source and outlet.
|
||||
* Example: TODO write out once exact API clear.
|
||||
* @param {string} name
|
||||
*/
|
||||
export function createPortalKey(name) {
|
||||
return new PortalKey(name);
|
||||
}
|
||||
@ -1,11 +1,5 @@
|
||||
<script>
|
||||
import { createPortalKey } from 'svelte';
|
||||
{@portal 'example'}
|
||||
|
||||
const key = createPortalKey('example');
|
||||
</script>
|
||||
|
||||
{@portal key}
|
||||
|
||||
{#portal key}
|
||||
{#portal 'example'}
|
||||
<p>portaled</p>
|
||||
{/portal}
|
||||
|
||||
@ -1,13 +1,7 @@
|
||||
<script>
|
||||
import { createPortalKey } from 'svelte';
|
||||
|
||||
const key = createPortalKey('example');
|
||||
</script>
|
||||
|
||||
{#portal key}
|
||||
{#portal 'example'}
|
||||
<p>portaled</p>
|
||||
{/portal}
|
||||
|
||||
<main>
|
||||
{@portal key}
|
||||
{@portal 'example'}
|
||||
</main>
|
||||
|
||||
@ -1,13 +1,7 @@
|
||||
<script>
|
||||
import { createPortalKey } from 'svelte';
|
||||
|
||||
const key = createPortalKey('example');
|
||||
</script>
|
||||
|
||||
<main>
|
||||
{@portal key}
|
||||
{@portal 'example'}
|
||||
</main>
|
||||
|
||||
{#portal key}
|
||||
{#portal 'example'}
|
||||
<p>portaled</p>
|
||||
{/portal}
|
||||
|
||||
Loading…
Reference in new issue