Skip to content

Commit a294bbc

Browse files
committed
add runtime script and mount
1 parent a5b7014 commit a294bbc

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export {default as DevTool} from './DevTool.svelte'
22
export * from './configure.js'
3+
export {mountUI as default} from './runtime.js'
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import DevTool from './DevTool.svelte';
2+
import { mount } from 'svelte';
3+
function create_devtool_host() {
4+
const id = 'svelte-devtool-host';
5+
if (document.getElementById(id) != null) {
6+
console.debug('svelte-devtool-host already exists, skipping');
7+
return;
8+
}
9+
const el = document.createElement('div');
10+
el.setAttribute('id', id);
11+
// appending to documentElement adds it outside of body
12+
document.documentElement.appendChild(el);
13+
return el;
14+
}
15+
export function mountUI(){
16+
if(typeof window !== 'undefined') {
17+
mount(DevTool, { target: create_devtool_host() });
18+
}
19+
}
20+
21+

0 commit comments

Comments
 (0)