You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a project where, for a number of reasons, I'd like to know how many messages are currently in the flash messages service. I'd use those to compute some properties and control application state. But I cannot figure out how to accurately listen for changes to the queue. If my application.js injects the service as flashMessages, I was thinking I'd be able to do something like:
Furthermore, when I try to use the Handlebars log helper, I get some strange results:
{{log flashMessages.queue}} --> only logs once on initial render and never again, regardless of number of messages in the queue {{log flashMessages.queue.length}} --> consistently logs each time the queue grows and shrinks.
I'm fine with my workaround for now, but I'd love to have slightly more control over this as my application grows in complexity.
Is there something I'm missing? Something I could do to start building computed properties around the number of messages in the flash service? This aside, we love the package! It's been extremely useful for us.
The text was updated successfully, but these errors were encountered:
I'm working on a project where, for a number of reasons, I'd like to know how many messages are currently in the flash messages service. I'd use those to compute some properties and control application state. But I cannot figure out how to accurately listen for changes to the queue. If my
application.js
injects the service asflashMessages
, I was thinking I'd be able to do something like:hasFlashMessages: Ember.computed('flashMessages.queue', function....
or
hasFlashMessages: Ember.computed('flashMessages.queue.@each', function....
or
hasFlashMessages: Ember.computed('flashMessages.queue.[]', function....
or something to that effect. None of these work. What has worked is doing it at a granular level in the corresponding HBS files:
Furthermore, when I try to use the Handlebars
log
helper, I get some strange results:{{log flashMessages.queue}}
--> only logs once on initial render and never again, regardless of number of messages in the queue{{log flashMessages.queue.length}}
--> consistently logs each time the queue grows and shrinks.I'm fine with my workaround for now, but I'd love to have slightly more control over this as my application grows in complexity.
Is there something I'm missing? Something I could do to start building computed properties around the number of messages in the flash service? This aside, we love the package! It's been extremely useful for us.
The text was updated successfully, but these errors were encountered: