
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
ToastmeJS is a very simple, flexible and light weigth plugin that shows Notifications and modal Dialogs on your website.
Want to see a quick demo? Click here
Light weight < 6kb
Full color, ligh and dark themes
Toastme does not have any dependencies. Just run next command:
$ npm install toastmejs --save
Then import toastme
import {toastme} from 'toastmejs'
or
const toastme = require('toastmejs')
Import the CSS via a <link />
and <scripts />
elements:
<link rel="stylesheet" href="https://unpkg.com/toastmejs@latest/dist/css/toastme.css">
<script src="https://unpkg.com/toastmejs@latest/dist/js/toastme.min.js" ></script>
Or simply download the files and include necesary CSS/JS files to your project.
Call one of these functions to show the notification you need
toastme.default("This is a 'default' notification")
toastme.success("This is a 'success' notification")
toastme.error("This is an 'error' notification")
toastme.warning("This is a 'warning' notification")
toastme.info("This is an 'info' notification")
You can customize duration, position, distance, z-index and a ligh theme
First, import the Toastme Class
import {Toastme} from 'toastmejs'
or
const {Toastme} = require('toastmejs')
Then, you need to declare a new Object with your new custom settings and create a new Toastme Class instance.
const config = {
timeout: 5000,
positionY: "bottom", // top or bottom
positionX: "center", // right left, center
distanceY: 20, // Integer value
distanceX: 20, // Integer value
zIndex: 100, // Integer value
theme: "default" // default, ligh or dark (leave empty for "default" theme)
};
const myToast = new Toastme(config);
Finally, you can call your new Toastme with new configurations:
myToast.success('This is a new success notification')
This works with a javascript Promise that returns True or False, depending on how you interact with it.
To use Dialogs, you just need declare the instance and set some default parameters:
//Example
toastme.yesNoDialog({
title: "You are the Winner!",
text: "Do you want to pick your price?",
textConfirm: "Confirm",
textCancel: "Cancel",
showCancel: true, // true or false
type: "success", // 'success', 'danger', 'warning', 'info' or 'question'
dark: false, // set 'true' if you want dark theme
}).then(function(value) {
if (value) {
console.log('You clicked Confirm')
} else {
console.log('You clicked Cancel')
}
});
You can customize text, title, buttons text and optionally, you can select 'type' of dialog for more specific needs.
Run this command if you need to recompile source files:
$ gulp
Version 1.2.7
Version 1.2.6
Version 1.2.5
Version 1.2.4
Version 1.2.3
Version 1.2.2
Version 1.2.1
Version 1.2.0
IMPORTANT: now you need to use brackets when importing toastmejs. Ex:
import { toastme } from 'toastmejs';
Note: "ligh" boolean option whitin notifications will be deprecated (and posibly removed) on next versions. Now you can select a specific theme.
License
MIT
Free Software, Hell Yeah!
FAQs
Web notifications and dialogs with pure javascript
The npm package toastmejs receives a total of 80 weekly downloads. As such, toastmejs popularity was classified as not popular.
We found that toastmejs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.