simple-toast-messages
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

simple-toast-messages

npm version GitHub issues GitHub forks GitHub stars GitHub license npm CodeFactor TypeScript

A simple TypeScript package that builds up a toast messaging system.

Installation

npm install simple-toast-messages

Usage

Possible Imports

// default import
import SimpleToastMessages from 'simple-toast-messages';

// named imports
import { SimpleToastMessages, stm, T, PositionEnum } from 'simple-toast-messages';

Example

// get the instance
const msg = SimpleToastMessages.getInstance();

// fire a success message with a timeout of 1 second and position top left
msg.success(message, {
  timeOut: 1000,
  position: PositionEnum.TOP_LEFT,
});

// fire a simple error message
msg.error(message);

// fire a info message with a timeout of 3 seconds and position bottom left
msg.info(message, {
  timeOut: 3000,
  position: PositionEnum.BOTTOM_LEFT,
  opacity: 0.8,
});

// fire a warning message with a timeout of 5 seconds and position bottom center
msg.warning(message, {
  timeOut: 5000,
  position: PositionEnum.BOTTOM_CENTER,
  opacity: 0.8,
});

Example Example Example Example

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.1
    6
    • latest

Version History

Package Sidebar

Install

npm i simple-toast-messages

Weekly Downloads

6

Version

2.0.1

License

MIT

Unpacked Size

122 kB

Total Files

62

Last publish

Collaborators

  • josunlp