-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Multiple Named Queues #153
Comments
There hasn't been prior discussion, but I'd be open to this with some thought around:
|
I like the idea for different queues to handle different tiers of messaging:
In response to your question, @poteto:
// Throw here if `foo` queue doesn't exist.
flashMessages.success(message, {queue: 'foo'}); {{#each flashMessages.queue.foo as |flash|}}
{{! flash from queue named foo}}
{{/each}} |
The addon is actually flexible enough to do this as is. Since we can pass in arbitrary extra values to a flash message, a flash "context" is pretty trivial: export default Ember.Component.extend({
flashMessages: Ember.inject.service("flashMessages"),
// Create a filtered flash queue by ctx
flashQueue: Ember.computed.filterBy("flashMessages.queue", "ctx", "foo"),
actions: {
doSomething() {
flashMessages.success("Success!", {ctx: "foo"});
}
}
}); {{#each flashQueue as |flash|}}
{{flash-message flash=flash}}
{{/each}} ... only shows |
@keighl this is not a solution to this problem since that will display flash message in the default queue as well. |
@shime If you're using the default queue, I suppose. When I implemented this context thing last year in a project, I didn't use the default queue since the whole point was that I needed contextual/scoped flashes. |
Has there been any thought into having multiple named queues, instead of just one queue as it exist today? My use case is that I have 2 sections on the page for flash type notifications...eventually there may be 3. Ideally, I would like to use this exact same component for all of them, the hbs code would simply loop over a different queue, i.e.:
If there has not been any previous discussion on this...any thoughts on doing this? I would be happy to do the work and submit a pull request, but first I wanted to see if this has been previously discussed.
The text was updated successfully, but these errors were encountered: