Skip to content

Differential/flash-messages

 
 

Repository files navigation

flash-messages

Package for displaying flash messages to the user. This is based on the chapter 'Creating a Meteorite Package' from the Discover Meteor Book and foundation-flash-messages package.

This package integrate well with Bootstrap Alerts styles, but Bootstrap is not a dependency.

You can see a demo and their source code.

##Note

The syntax has changed on version 0.2.0

##Usage

Include the template somewhere in your index.html file:

  {{> flashMessages}}

And then send messages:

  FlashMessages.sendAlert(MESSAGE);
  FlashMessages.sendError(MESSAGE);
  FlashMessages.sendSuccess(MESSAGE);
  FlashMessages.sendInfo(MESSAGE);

To clear messages:

  FlashMessages.clear();

Only the seen messages will be cleared.

##Configure

You can configure globally the way the messages behave with FlashMessages.configure:

  FlashMessages.configure({
    autoHide: true,
    hideDelay: 5000
  });

You can also set individual options on messages. This will override global configuration:

  FlashMessages.sendAlert(MESSAGE, { autoHide: false });
  FlashMessages.sendError(MESSAGE, { hideDelay: 2000 });
  FlashMessages.sendSuccess(MESSAGE, { autoHide: true, hideDelay: 8000 });
  FlashMessages.sendInfo(MESSAGE);

About

Package for displaying flash messages to the user

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • JavaScript 100.0%