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

notyf-js

v2.1.2

Published

A dead simple, responsive, vanilla javascript notification plugin. No jQuery required

Downloads

13

Readme

Notyf

Notyf is a dead simple, responsive, vanilla javascript notification plugin. No jQuery required.

Demo: carlosroso.com/notyf

demo gif

Installation

npm

npm install --save notyf-js

Now add it to your project:

<html>
  <head>
    ...
    <link rel="stylesheet" type="text/css" href="/path/to/notyf.min.css">
  </head>
  <body>
    ...
    <script src="/path/to/notyf.min.js" type="text/javascript"></script>
  </body>
</html>

Usage

Basic

// Create an instance of Notyf
var notyf = new Notyf();

// Display an alert notification
notyf.alert('You must fill out the form before moving forward');

// Display a warning notification
notyf.warn('It's better if you fill out the form before moving forward!');

// Display a success notification
notyf.confirm('Your changes have been successfully saved!');

CommonJS

When importing Notyf via CommonJS modules, for example for Vue or Angular on top of Webpack, you can import the module as shown below:

// Import Notyf using CommonJS require
var Notyf = require('notyf');
import 'notyf/dist/notyf.min.css';

// Create an instance of Notyf
var notyf = new Notyf()

// Display an alert notification 
notyf.alert('Please fill out the form')

Options

You can set some options when creating a Notyf instance.

new Notyf([options])

Param | Type | Default | Details ------------ | ------------- | ------------- | ------------- delay | Number | 2000 | Number of miliseconds the notification must be shown alertIcon | String | Custom Notyf icon | CSS class of the icon shown in an alert notification warnIcon | String | Custom Notyf icon | CSS class of the icon shown in an warning notification confirmIcon | String | Custom Notyf icon | CSS class of the icon shown in a success notification

This is an example of setting Notyf with a 1s delay and FontAwesome alert and success icons (be sure to include FontAwesome in your project):

var notyf = new Notyf({
  delay:1000,
  alertIcon: 'fa fa-exclamation-circle',
  warnIcon: 'fa fa-exclamation-circle',
  confirmIcon: 'fa fa-check-circle'  
})

Licence

Notyf is under MIT licence