marcorinck / angular-growl

growl-like notifications for angularJS projects
MIT License
477 stars 191 forks source link

Add option for idempotent messaging #8

Open gustafnk opened 11 years ago

gustafnk commented 11 years ago

In some scenarios it might be valuable to NOT add a growl message if there already exists a message with the exact same text.

For example, I have generic http error handler in a service and if something fails, I get one message for each failed http request. But I would only like to display a single growl message to the user.

This is of course specific to my application, but I think it could be valuable to others as well. Would you be interested in a pull request for this functionality?

marcorinck commented 11 years ago

yes, that would make sense, absolutely.

In fact, I think that should be the standard behaviour, which you should be able to turn off via $growlProvider.

If you want to send a PR please send it to development branch.

marcorinck commented 11 years ago

maybe you should name the option "onlyUniqueMessages" or sth. like that. While "idempotent" is technically correct, it would be easier to understand.

gustafnk commented 11 years ago

Yeah, that is a much friendlier name :)

marcorinck commented 11 years ago

I just checked in my solution to the development branch, what do you think?

gustafnk commented 11 years ago

Beat me to it :) I think it looks good.