jackbsteinberg / std-toast

120 stars 4 forks source link

Handling Toast actions (buttons and links) #11

Closed jackbsteinberg closed 5 years ago

jackbsteinberg commented 5 years ago

When the developer is creating a toast in HTML using , they can include in the children button(s) that will take some action upon user feedback. At this point, the intention is to have an actionclick event that would fire when a with a single button or link has had that button or link clicked.

I see two issues with including this as our action support:

A proposal that came up in #9 to solve this second issue was to allow the developer to pass in an action like so:

const toast = showToast("message", {
  action: ['Click me', doSomething]
});

This same pattern could also be used to pass in a list of actions, but would have the same issue with actionclick. This pattern would also need to be amended to support both buttons and links.

jackbsteinberg commented 5 years ago

Some ideas from #9: