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

utils-deva

v1.0.7

Published

utility functions and classes at finger-tips

Downloads

60

Readme

About The Project

Every website need some common elements to be implemented for a consistent UI/UX. Here are some simple UI components and funtionalities just a function call away. These all classes & functions are a solution to the problems that I faced while developing various websites, I bundled them together here.

Use these functionalities because:

  • Your time should be focused on creating something amazing. A project that solves a problem and helps others
  • You shouldn't be writing the same code over and over again.
  • You should implement DRY principles to the rest of your life :smile:

Built With

JavaScript   HTML   CSS

Installation

• Include the main.js file in your project and create a new instance of a class.

<script src="path/to/main.js"></script>
<!-- OR -->
<script src="https://cdn.jsdelivr.net/gh/devashishp1999/utils-deva@main/main.min.js"></script>

<script>
  const toast = new Toast();

  toast.show(); // Show default toast
</script>
npm i utils-deva
https://devashishp1999.github.io/utils-deva/main.min.js

or

https://cdn.jsdelivr.net/gh/devashishp1999/utils-deva@main/main.min.js

List of Classes :

The Toast class provides a simple and flexible way to create and manage toast notifications in your web application. It allows you to easily customize the look, position and behavior of the toasts, and provides methods for showing, hiding and removing toasts.

Showing a Toast

To show a toast, call the show() method on the Toast instance and pass in an options object.

toast.show({
  text: "Hello World",
  position: "top",
  duration: 3,
  styles: {
    backgroundColor: "red",
    color: "white",
    fontSize: "20px",
  },
  animations: {
    slideIn: "1s",
  },
  fonts: {
    fontFamily: "Arial",
  },
});

Removing a Toast

To remove a specific toast, call the remove() method on the Toast instance and pass in the toast element as an argument.

toast.remove(toastElement);

Removing All Toasts

To remove all toasts, call the removeAll() method on the Toast instance.

toast.removeAll();

Configuration

The options object passed to the show() method can include the following properties:

Example

const toast = new Toast();
toast.show({
  text: "Hello World",
  position: "top",
  duration: 2.5,
  styles: {
    backgroundColor: "red",
    color: "white",
    fontSize: "20px",
  },
  animations: {
    slideIn: "1s",
  },
  fonts: {
    fontFamily: "Arial",
  },
});

This will create a new toast with the text "Hello World" and position it on the top of the screen and it will be removed after 3000ms. Also the toast will slide in from 1s with custom background color, color and font size and font family.

Browser Support

This library uses querySelector and appendChild which are supported by all modern browsers.

Docs are not updated : Contact [email protected]

License

Hope this library will be helpful for you.