Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choose Between Displaying Multiple Toasts Or Just One #108

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Commits on Aug 31, 2022

  1. Updated Toastify class variables and show/hide functions to support t…

    …he use of only a single toast at a time
    
    I still need to test the code, but the basics are there. The class Toastify will have a class variable multiple, and when set to false, will only allow one toast to appear on the screen at a time. To accomplish this, there is a class variable activeToasts that is an array of all the toasts that are currently shown on the screen. In the showToast function, check if the multiple variable is false, if it is, call the hideToast function on each toast that is showing, then add the current toast to the activeToasts array. In hideToast, we now also remove the current toast from the activeToasts array.
    TrevorSlobodnick committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    dbad7ee View commit details
    Browse the repository at this point in the history
  2. The code added in toastify-es.js was also put in toastify.js

    Looking at the code again, I am not sure what toastiy-es.js is used for, but I figured it wouldnt hurt to add the code to both files.
    TrevorSlobodnick committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    464757b View commit details
    Browse the repository at this point in the history
  3. Added the UI for the toggle multi-toast to the demo

    Only the UI is finished, currently toggling does nothing, but that will change soon.
    TrevorSlobodnick committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    53292be View commit details
    Browse the repository at this point in the history

Commits on Sep 1, 2022

  1. Updated Toastify class variables and show/hide functions to support t…

    …he use of only a single toast at a time
    
    I still need to test the code, but the basics are there. The class Toastify will have a class variable multiple, and when set to false, will only allow one toast to appear on the screen at a time. To accomplish this, there is a class variable activeToasts that is an array of all the toasts that are currently shown on the screen. In the showToast function, check if the multiple variable is false, if it is, call the hideToast function on each toast that is showing, then add the current toast to the activeToasts array. In hideToast, we now also remove the current toast from the activeToasts array.
    TrevorSlobodnick committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    bcbfd69 View commit details
    Browse the repository at this point in the history
  2. The code added in toastify-es.js was also put in toastify.js

    Looking at the code again, I am not sure what toastiy-es.js is used for, but I figured it wouldnt hurt to add the code to both files.
    TrevorSlobodnick committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    42f0d99 View commit details
    Browse the repository at this point in the history
  3. Fixed type and added function in script.js that toggles Toastify.mult…

    …iple when a checkbox is clicked
    
    There is a small bug, if I declare Toastify.multiple = true to start, then later switch it to false, it will allow 2 toasts on the screen at the same time. But it works as expected if Toast.multiple = false is set from the start... I will look into this bug
    TrevorSlobodnick committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    5fa5714 View commit details
    Browse the repository at this point in the history
  4. Bug fixed - Correctly displaying 1 toast at a time instead of 2 when …

    …Toastify.multiple = false
    
    In my previous commit I mentioned there was a bug where more than one toast would appear even when Toastify.multiple = false. This is because I thought that the hideToast() function was called every time a toast "ended". After looking into it, it is actually the "removeElement" function that gets called everytime, so I moved my code to that function and now everything is running how it should.
    TrevorSlobodnick committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    90d7353 View commit details
    Browse the repository at this point in the history
  5. Update README.md

    TrevorSlobodnick committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    946a731 View commit details
    Browse the repository at this point in the history
  6. Update README.md

    TrevorSlobodnick committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    8da3d6c View commit details
    Browse the repository at this point in the history