Webanizr Logo
Open / sluit menu
Module snackbarMessage

Last change: January 22, 2020

Current version: 1.1.1

The snackbarMessage message can be used to show updates to the website visitor.

syntax

webanizr.send('snackbarMessage', data, parameters, callback);

data

The data containing the update that has to be shown to the website visitor.

parameters

The snackbarMessage module accepts the following parameters:

class__message (optional)

This gives the message a background color. By default there's no classname filled, therefor the background color of the snackbar message is blue. Possible class__message options to use are: 

warn: The background color will be yellow.
error: The background color will be red.
info: The background color will be green.

transform__data (optional)

There are two possible values for this attribute: stringify and key-value. stringify creates an json string from the given data  which is used as message to the visitor. If key-value is chosen, the value from an attibute in the data is used as message to the website visitor.

If this attribute is omitted or has an incorrect value, the option stringify is used.

key__message (required when transform__data is key-value)

The name of the attribute in data which contains the message to the user.

Example for key__message:

if the following data is received:

{
    error: "operation failed"
} 

And the following parameters are used:

{
    transform__data : "key-vaue",
    key__message : "error"
}

The message to the visitor will be "operation failed".

time__visible (optional)

The number of miliseconds the message will be visible.

callback

The callback function is called with the original data.

demo

https://cdn.cpmodules.webanizr.com/demo/snackbar-demo/index.html

Changelog

  • January 22, 2020: 1.1.1 - fixed the bug that when there's no snackbar message, the container of the snackbar messages still exists.