0.0.1 • Published 2 years ago
@developedbyant/svelte-toasts v0.0.1
Simple svelte toasts module
Import module Import the main svelte component to your layout,footer or nav
<script lang="ts">
import Toasts from "@developedbyant/svelte-toasts/Toasts.svelte";
// Import function to add new toast
// Optional import New toast input interface
import { newToast,type ToastLoad } from "@developedbyant/svelte-toasts"
// Or
import { newToas } from "@developedbyant/svelte-toasts"
import type { ToastLoad } from "@developedbyant/svelte-toasts"
// New toast data interface
interface ToastLoad = {
type:"error" | "ok" | "neutral"
title?:string
msg:string
}
// Test function for this demo
// typeForDemo
let typeForDemo = [ "error", "ok", "neutral" ]
function addNewToast(){
const newToastData:ToastLoad = { title:"Post", type:type[0],msg:`Test ${Math.random()}`}
newToast(newToastData)
type.push(type[0])
type.shift()
}
</script>
<!-- Place toasts component -->
<Toasts />
0.0.1
2 years ago