Skip to content

Commit d632f47

Browse files
committed
Update CDN usage doc
1 parent fd4a0bd commit d632f47

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,21 @@ toast.push('Hello world!')
7676
Or if you prefer to go old-school javascript and a CDN:
7777

7878
```html
79-
<html>
8079
<head>
8180
...
82-
<script defer src="https://cdn.jsdelivr.net/npm/@zerodevx/svelte-toast@0"></script>
81+
<script>
82+
function registerToast() {
83+
window.toastApp = new window.SvelteToastUMD.SvelteToast({
84+
target: document.body
85+
});
86+
window.toast = window.SvelteToastUMD.toast;
87+
88+
// Now you can `toast` anywhere!
89+
toast.push('Hello world!');
90+
}
91+
</script>
92+
<script async src="https://cdn.jsdelivr.net/npm/@zerodevx/svelte-toast@0" onload="registerToast()"></script>
8393
</head>
84-
<body>
85-
<body>
86-
</html>
8794
```
8895

8996

0 commit comments

Comments
 (0)