-
Notifications
You must be signed in to change notification settings - Fork 84
BuildFire Toast Component
This sdk documentation is deprecated and will not be updated. Check out our new docs at https://sdk.buildfire.com/docs/toast/
The toast component provides brief, contextual messages about app processes at the bottom of the screen. Each toast message contains a message and an optional action.
This component only functions on the widget!
The following must be included in the index.html file of the widget or service.
<script src="../../../scripts/buildfire.min.js"></script>
<script src="../../../scripts/buildfire/components/toast/toast.js"></script>This method is used to show a toast message. The toast will automatically close after a short time.
The options object can contain the following:
-
text: String, required. This renders as the message of the toast -
action: Object, optional-
title: Renders as the action button text. -
actioncan contain any optional data to be handled when that action button is clicked. - See How to use action items for action item support
- When the action is clicked, the action is returned in the callback.
-
-
hideDismiss: Boolean, optional. Iftrue, the dismiss button is hidden from the modal.
The callback function is executed when the user takes an action, or an error occurs.
-
error: Any errors that occur -
result: The action passed tooptions.actionis returned if the user clicks the action button
const options = {
text: 'User added to Favorites',
action: {
title: 'Undo',
userId: 'fb942c43e9'
}
};
const callback = (error, result) => {
if (error) throw error;
if (result.userId) {
Favorites.remove(userId);
}
};
buildfire.components.toast.showToastMessage(options, callback);This method is used to close toast message. The toast will close itself after a short time, or if options.force is passed it will close immediately.
The options object can contain the following:
-
force: Boolean, optional. Iftrue, the toast will close immediately.
The callback function is executed when the closing action is successfully registered.
-
error: Any errors that occur