flish
Flash messages made simple
npm install flish --save
var flish =
API
- flish methods are chainable
- flish is designed for flash messages or notifications, but it can be used for generic tasks too
flish()
- Get a flish instance
- @return object
.use(handler)
- Set the flash handler that gets invoked with the outgoing flashes array whenever
.send()
is called - @return this
.add(flash)
- Enqueue flash string, object, or function
- @return this
.send()
- Flush and dispatch the flash queue
- @return this
Examples
Log flash messages
var flish = // Create a flash instance and define its handlervar flash = // Add some flashes and then send themflashflashflash // logs 'You rock!' and 'You roll!'flashflash // logs 'You stole!'flash // logs nothing because no new flashes were added
Flash message objects
var flish = var flash = flash
HTML flash messages
var flish = var flash = flash
Flish instances are like arrays
var flish = var flash = if flashlength flash if flash flash
License
MIT