diff --git a/components/overlay/container.go b/components/overlay/container.go
index 1832c48..23bcc93 100644
--- a/components/overlay/container.go
+++ b/components/overlay/container.go
@@ -52,7 +52,7 @@ func (c *Container) handleToastClose(event vugu.DOMEvent, toast vugu.Builder) {
c.CloseToast(toast)
}
-func (c *Container) AddToast(event vugu.DOMEvent, component vugu.Builder) {
+func (c *Container) AddToast(eventEnv vugu.EventEnv, component vugu.Builder) {
toast := ContainerToast{
body: component,
signalClasses: "d3c-color-accent",
@@ -67,8 +67,8 @@ func (c *Container) AddToast(event vugu.DOMEvent, component vugu.Builder) {
if durationGetter, ok := component.(ToastDurationGetter); ok && durationGetter.ToastDuration() > 0 {
go func(component vugu.Builder) {
time.Sleep(durationGetter.ToastDuration())
- event.EventEnv().Lock()
- defer event.EventEnv().UnlockRender()
+ eventEnv.Lock()
+ defer eventEnv.UnlockRender()
c.CloseToast(component)
}(component)
}
diff --git a/page-overlays.go b/page-overlays.go
index 4c7a6da..7bbc6ba 100644
--- a/page-overlays.go
+++ b/page-overlays.go
@@ -25,7 +25,7 @@ func (c *PageOverlays) handleSimpleModalButton(event vugu.DOMEvent) {
}
func (c *PageOverlays) handleSimpleToastButton(event vugu.DOMEvent) {
- c.AddToast(event, &overlay.ToastSimple{
+ c.AddToast(event.EventEnv(), &overlay.ToastSimple{
IconSlot: &icons.LInfoCircle{AttrMap: vugu.AttrMap{"style": "font-size: 2em;"}},
Message: "This is a simple toast!\nIt supports multiple lines and has an icon slot.\nThere also can be multiple of it at the same time, this one was opened at " + time.Now().Format(time.TimeOnly) + ".",
SignalColor: "d3c-color-attention",
@@ -33,7 +33,7 @@ func (c *PageOverlays) handleSimpleToastButton(event vugu.DOMEvent) {
}
func (c *PageOverlays) handleWarningToastButton(event vugu.DOMEvent) {
- c.AddToast(event, &overlay.ToastSimple{
+ c.AddToast(event.EventEnv(), &overlay.ToastSimple{
IconSlot: &icons.LWarning{AttrMap: vugu.AttrMap{"style": "font-size: 2em;", "class": "d3c-color-caution d3c-icon-use-color"}},
Message: "This is a warning, be careful!",
SignalColor: "d3c-color-caution",
@@ -41,11 +41,11 @@ func (c *PageOverlays) handleWarningToastButton(event vugu.DOMEvent) {
}
func (c *PageOverlays) handleToastMessageButton(event vugu.DOMEvent) {
- c.AddToast(event, &overlay.ToastMessage{MessageType: overlay.ToastMessageTypeCritical, Message: "Uh oh!"})
+ c.AddToast(event.EventEnv(), &overlay.ToastMessage{MessageType: overlay.ToastMessageTypeCritical, Message: "Uh oh!"})
}
func (c *PageOverlays) handleToastMessageTimeoutButton(event vugu.DOMEvent) {
- c.AddToast(event, &overlay.ToastMessage{MessageType: overlay.ToastMessageTypeSuccess, Message: "That worked!", Duration: 5 * time.Second})
+ c.AddToast(event.EventEnv(), &overlay.ToastMessage{MessageType: overlay.ToastMessageTypeSuccess, Message: "That worked!", Duration: 5 * time.Second})
}
func (c *PageOverlays) handleWaitOverlayButton(event vugu.DOMEvent) {
diff --git a/page-overlays.vugu b/page-overlays.vugu
index 8dccb6e..053415e 100644
--- a/page-overlays.vugu
+++ b/page-overlays.vugu
@@ -44,14 +44,14 @@
To let the toast close itself after some time, you can use the