Skip to content

New module: toast.js, plus serializeForm

Choose a tag to compare

@awangga awangga released this 11 Sep 22:15
· 83 commits to main since this release
  • New toast.js: notifications with no external dependency, as an alternative to loading SweetAlert2 just to show a message. Provides toast(message, type, duration) and the shortcuts toastSuccess, toastError, toastWarning, toastInfo. Each returns a dismiss() function, and duration: 0 keeps the toast until you dismiss it, which suits a loading state. The CSS is injected by the module itself, so there is no separate stylesheet to import.
  • New serializeForm(id) in element.js: returns every named form field as one {name: value} object, so getValue() no longer has to be called field by field before postJSON(). Disabled fields and file inputs are skipped; file uploads need postFile/postFileJSON.

Docs: https://croot.js.org/docs/toast and https://croot.js.org/docs/element/