Open zdila opened 7 years ago
Just in case, here is the full implementation with additional features:
And one of the usages: https://github.com/FreemapSlovakia/freemap-v3-react/blob/master/src/components/DistanceMeasurementResult.js#L153
Thanks @zdila I had the basics started in my notification example, but you have taken it much further. Thanks for sharing.
Our usecase is that we add toasts with payload
{ "type": "TOASTS_ADD", "payload" { "id": <toast_unique_id>, "timeout": <optional_timeout>, "message": <message> } }
and remove them with payload{ "type": "TOASTS_REMOVE", "payload": <toast_unique_id>}
. Removal is done manually or on timeout.If it is done manually then we would like to cancel logic (waiting on toast timeout) by
<toast_unique_id>
. From API it seems that only type can be used for cancellation, without any payload support.Therefore we've created "workaround":
Is this approach OK?