I saw that, on removal, messages are filtered by text. With this method, multiple messages having the same text will potentially be removed before the end of their timeout when the first one is firing.
So I suggest to filter them by a unique property:
Added sequential id property to FlashMessage to distinguish them
Added id property of type number in FlashMessageInterface
Added a static nextId variable in FlashMessage to save the next id value
Added the id property in FlashMessage and assigning it to the current next id value from nextId then increment the static var
Changed the closure provided to filter by an arrow function checking message comparing id property instead of text property
Note: This implementation with a static class variable is chosen for simplicity. Some other choices would be possible as well.
Hi again
I saw that, on removal, messages are filtered by text. With this method, multiple messages having the same text will potentially be removed before the end of their timeout when the first one is firing. So I suggest to filter them by a unique property:
Added sequential id property to FlashMessage to distinguish them
id
property of type number inFlashMessageInterface
nextId
variable inFlashMessage
to save the next id valueid
property inFlashMessage
and assigning it to the current next id value fromnextId
then increment the static varid
property instead oftext
propertyNote: This implementation with a static class variable is chosen for simplicity. Some other choices would be possible as well.