Giter VIP home page Giter VIP logo

flash-notifications's Introduction

flash-notifications

Flash Notifications for MeteorJS

Built for use with bootstrap styles, but bootstrap is not required. Integrates easily with Iron Router

Inspiration and and a great start on the code came from: http://stackoverflow.com/questions/14086958/whats-a-good-way-to-handle-flash-notifications-in-meteor-with-meteor-router and Telesc.pe

Usage

Drop these in your template somewhere

Flash-Notifications comes with support for displaying all of the notifications together, or for displaying notifications by type.

To display all notifications together just drop this into your template where you want the notifications.

{{> flashes}}

To display only success, error, warning, or info messages, you can use specific templates like this. Note that if you are not displaying a template, but create a message, it will still get marked as seen.

{{> successFlashes}}
{{> errorFlashes}}
{{> warningFlashes}}
{{> infoFlashes}}

To create a flash notification for the user

flash.success('This is a success message');
flash.error('This is a error message');
flash.info('This is a info message');
flash.warning('This is a warning message');

Iron Router integration

Flash notifications can automatically be dismissed if they have been seen for more than 250ms and the user visits a new route if you have Iron Router installed.

Drop this into your routes.js file:

Router.before(function() {
    flash.clear();
});

or if you already have a global before function defined add this to it.

flash.clear();

if you want to have flashes automatically dismissed when users visit new routes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.