toastinette
v1.0.0
Published
Ultra lightweight notification library
Downloads
1
Maintainers
Readme
Toastinette
The challenge was to create a notification library under 1 KB.
Therefore, Toastinette is an ultra-lightweight (minified CSS + JS <= 1 KB) notification library with no dependencies. It does not accept user input and there is no progress bar.
Size
| File | Size (bytes) | | --------------------- | ------------:| | toastinette.min.js | 696 B | | toastinette.min.css | 328 B | | Total | 1024 B |
Installation
Manual
In the <head>
section:
<link rel="stylesheet" type="text/css" href="dist/toastinette.min.css">
At the bottom of the <body>
:
<script src="dist/toastinette.min.js"></script>
npm
todo
Usage
Toastinette.show(type, duration, html);
Creates a new toast.
type
: Either'success'
,'info'
,'warning'
or'error'
duration
: Show duration in mshtml
: HTML code of the toast
Toastinette.setPosition(position, margin = 12);
Set the position of the toasts.
position
:'tl'
for top left,'tr'
for top right,'br'
for bottom right (default) or'bl'
for bottom leftmargin
: Optional. The margin in px. Default is 12px.