apvarun / toastify-js

Pure JavaScript library for better notification messages
https://apvarun.github.io/toastify-js/
MIT License
2.13k stars 230 forks source link

This commit addresses the issues #70 and #71 #72

Closed ghost closed 3 years ago

ghost commented 3 years ago

Global Options and New Option

This PR adds the following features:

1 - Global Options

The global options act as the defaults for each option for the Toastify object. These defaults were hard-coded on the constructor.

In this PR they were transferred to the Toastify.defaults object. The user can set them as follows:

Toastify.defaults.duration = 10000;
Toastify.defaults.backgroundColor ='#000000c0';

2 - Oldest First

This is a simple global option that can be set in the same way of the other global options:

Toastify.defaults.oldestFirst = false;

Notes

  1. Despite this PR has been working fine in my local environment, I didn't do any extensive set of tests. I'm doing this "on-demand", as I need to use a new option. I count on the contributors help for that.
  2. Any suggestions and comments are welcome.

@apvarun

apvarun commented 3 years ago

Really cool PR @almir-campos