Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

toastify-js

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

toastify-js - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

2

package.json
{
"name": "toastify-js",
"version": "1.4.0",
"version": "1.5.0",
"description": "Toastify is a lightweight, vanilla JS toast notification library.",

@@ -5,0 +5,0 @@ "main": "./src/toastify.js",

@@ -6,3 +6,3 @@ # Toastify

[![toastify-js](https://img.shields.io/badge/toastify--js-1.4.0-brightgreen.svg)](https://www.npmjs.com/package/toastify-js)
[![toastify-js](https://img.shields.io/badge/toastify--js-1.5.0-brightgreen.svg)](https://www.npmjs.com/package/toastify-js)

@@ -9,0 +9,0 @@ Toastify is a lightweight, vanilla JS toast notification library.

/*!
* Toastify js 1.4.0
* Toastify js 1.5.0
* https://github.com/apvarun/toastify-js

@@ -21,3 +21,3 @@ * @license MIT licensed

// Library version
version = "1.4.0";
version = "1.5.0";

@@ -40,2 +40,4 @@ // Defining the prototype of the object

this.toastElement = null;
// Validating the options

@@ -122,3 +124,3 @@ this.options.text = options.text || "Hi there!"; // Display message

// Clear timeout while toast is focused
if (this.options.stopOnFocus) {
if (this.options.stopOnFocus && this.options.duration > 0) {
const self = this;

@@ -129,3 +131,3 @@ // stop countdown

function(event) {
window.clearTimeout(event.target.timeOutValue);
window.clearTimeout(divElement.timeOutValue);
}

@@ -184,3 +186,3 @@ )

// Creating the DOM object for the toast
var toastElement = this.buildToast();
this.toastElement = this.buildToast();

@@ -201,3 +203,3 @@ // Getting the root element to with the toast needs to be added

// Adding the DOM element
rootElement.insertBefore(toastElement, rootElement.firstChild);
rootElement.insertBefore(this.toastElement, rootElement.firstChild);

@@ -207,9 +209,11 @@ // Repositioning the toasts in case multiple toasts are present

toastElement.timeOutValue = window.setTimeout(
function() {
// Remove the toast from DOM
this.removeElement(toastElement);
}.bind(this),
this.options.duration
); // Binding `this` for function invocation
if (this.options.duration > 0) {
this.toastElement.timeOutValue = window.setTimeout(
function() {
// Remove the toast from DOM
this.removeElement(this.toastElement);
}.bind(this),
this.options.duration
); // Binding `this` for function invocation
}

@@ -220,2 +224,9 @@ // Supporting function chaining

hideToast: function() {
if (this.toastElement.timeOutValue) {
clearTimeout(this.toastElement.timeOutValue);
}
this.removeElement(this.toastElement);
},
// Removing the element from the DOM

@@ -222,0 +233,0 @@ removeElement: function(toastElement) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc