npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

toastmaker

v1.0.9

Published

ToastMaker is a light javascript library for showing toast notifications on web page

Downloads

1,454

Readme

ToastMaker

GitHub Workflow Status Quality Gate Status Coverage Code Smells

npm bundle size npm GitHub

Toast Maker is a simple and very lightweight javascript library for showing toast notification messages on web page. It provides multiple configurations to customize the toast styling(font, background, size ... anything), duration, position etc.

Demo

ToastMaker Demo

Features

  • Small footprint
  • Customizable styling
  • Can be used with vanilla javascript or npm project
  • Works with - IE10, IE11, Edge, Chrome, Firefox, Safari, Opera

Include toastmaker library into the project

Install toastmaker module in npm project

Follow the steps mentioned below to install the library in npm project.

npm install --save toastmaker

or

yarn add toastmaker -S

After adding the toastmaker module to your project, import it in your script as shown below.

import ToastMaker from 'toastmaker';
import "toastmaker/dist/toastmaker.css";

NOTE: The toastmaker.css is the default css file. If you want you can refer to it and create your own css file and import it instead of this default one.

Include toastmaker library in a plain html

ToastMaker can also be used with plain vanilla javascript project. Just add the minified javascript and css file in you main html and you can start using it inside the javascript.

<link rel="stylesheet" type="text/css" href="https://unpkg.com/toastmaker/dist/toastmaker.min.css">

<script type="text/javascript" src="https://unpkg.com/toastmaker/dist/toastmaker.min.js"></script>

If you want you can download the bundle from the releases section, then include & reference the files locally rather than using the cdn links.

How to use?

Using ToastMaker is very simple. Create a toast by passing the text message, as shown in below example

  ToastMaker('Hi There!');

If you want to change the default timeout, position, styling etc you can pass the optional arguments. Refer below example.

  ToastMaker('Hi There!', 2000,  {
    styles: { fontSize: '18px', backgroundColor: 'green' },
    classList: ['custom-class', 'other-custom-class'],
    align: 'right',
    valign: 'top'
  });

Use your own styles and css classes

You can specify multiple styles or your own css classes using styles and classList options respectively. This is useful in case you want to change the background, font-size, color, padding, border, ... and a lot of other styling as per your requirement.

  ToastMaker("Hi There!", 2000,  {
    styles: { fontSize: "15px" },
    classList: ["custom-class"]
  });

For more examples, check out the live demo page - ToastMaker Demo

Options

| Option | Type / Allowed Values | Description | Default | Mandatory? |-----------------|-----------------|------------------|-----------------|-----------------| | text | string | Text message to be shown in toast | N/A | Yes | | timeout | number | Duration (In milliseconds) for which the toast should be displayed | 3000 | No | | styles | object | Object containing style properties to be applied to toast | N/A | No | | classList | array | Array of css classes to be applied to toast | N/A | No | | align | 'left' 'center' 'right' | Horizontal alignment for toast | 'center' | No | | valign | 'top' 'bottom' | Vertical alignment for toast | 'bottom' | No |

Note: All options except text and timeout needs to be wrapped inside an object and passed to the ToastMaker as the 3rd argument.

Refer How to use? section to know how these options should be used with the ToastMaker function.

Bundle size

| | size | gzip | | :----------- | ------------------: | ------------------: | | toastmaker | toastmaker_size | toastmaker_gzip | | toastify-js | toastify-js_size | toastify-js_gzip | | toastr | toastr_size | toastr_gzip |

Versioning

For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE.md file for details