No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to limit number of Notify messages?

    Framework
    1
    1
    642
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      steve last edited by steve

      What is the best way to limit the number of Notify dialogs that are displayed on a screen?

      It would be nice to have:

      • Global control (max # that can be displayed at a single time)
      • Ability to scope/group them, by name/id

      0_1522259088295_cd371466-67a9-45c9-b00e-113e31653c64-image.png

      Perhaps for now I could do something like:

      var notifyLimit = 1
      var notifies = {}
      ...
      createNotify('negative', 'This is a message', 'action1')
      ...
      function createNotify(type, message, scope) {
         if (scope in this.notifies) {
             // Check limit
             if (this.notifies[scope].length === this.notifyLimit ) {
                 this.notifies[scope][0].dismiss()
                 delete this.notifies[scope][0]
             }
         }
         let notify = Notify.create({ type: type, message })
         this.notifies[scope].push(notify)
      }
      ...
      function clearAllNotfies() {
          for (scope in this.notifies) {
              for (var i = 0; i < notifies[scope].length; i++) {
                  notifies[scope][i]].dismiss()
              }
          }
          this.notifies = {}
      }
      

      btw, I haven’t tested the above, just quickly mocked it up. Also, not even sure Notify.dismiss() works that way 😛

      1 Reply Last reply Reply Quote 0
      • First post
        Last post