Skip to content

Commit 1cf3516

Browse files
committed
oof
1 parent 0633a39 commit 1cf3516

File tree

4 files changed

+1931
-14
lines changed

4 files changed

+1931
-14
lines changed

lib/Plot.svelte

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<script lang="ts">
2+
import { onMount } from 'svelte';
3+
let Plotly: null | typeof import("plotly.js");
4+
5+
export let element: HTMLDivElement = null as never;
6+
7+
console.log(element);
8+
9+
onMount(async () => {
10+
Plotly = await import("plotly.js");
11+
console.log('loaded', Plotly);
12+
});
13+
</script>
14+
15+
<div bind:this={element}></div>

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "svelte-plotly.js",
3-
"version": "0.0.1",
3+
"version": "1.0.0",
44
"scripts": {
55
"dev": "svelte-kit dev",
66
"build": "svelte-kit build",
@@ -17,6 +17,7 @@
1717
"@sveltejs/kit": "next",
1818
"@typescript-eslint/eslint-plugin": "^5.10.1",
1919
"@typescript-eslint/parser": "^5.10.1",
20+
"buffer": "^6.0.3",
2021
"eslint": "^8.12.0",
2122
"eslint-config-prettier": "^8.3.0",
2223
"eslint-plugin-svelte3": "^4.0.0",
@@ -28,5 +29,9 @@
2829
"tslib": "^2.3.1",
2930
"typescript": "~4.6.2"
3031
},
31-
"type": "module"
32-
}
32+
"type": "module",
33+
"dependencies": {
34+
"@types/plotly.js": "^1.54.20",
35+
"plotly.js": "^2.12.1"
36+
}
37+
}

src/routes/index.svelte

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1+
<script lang="ts">
2+
import Plot from "../../lib/Plot.svelte";
3+
</script>
4+
15
<h1>Welcome to SvelteKit</h1>
26
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
7+
8+
<Plot />

0 commit comments

Comments
 (0)