An open API service indexing awesome lists of open source software.

https://github.com/codeyellowbv/marionette-notifications

Show notifications in a Marionette region
https://github.com/codeyellowbv/marionette-notifications

Last synced: 11 months ago
JSON representation

Show notifications in a Marionette region

Awesome Lists containing this project

README

          

# marionette-notifications
Shows sexy notifications in a region.

Some features:

- When a notification is added that already has the same content as a notification that already exists, no notification is added.
- A notification will disappear after 3 seconds. When hovering over a notification, it will not disappear.

Installation:

```
$ npm install marionette-notifications --save
```

## Usage

First make sure you have `underscore`, `marionette` and `backbone` as a dependency.

Now create a view where you listen to all events that need to trigger a notification (I will name it `view/notification.js`);

```js
var Notification = require('marionette-notifications').CollectionView;
var vent = require('vent');

module.exports = Notification.extend({
initialize: function () {
Notification.prototype.initialize.call(this);

// Listen to events here, e.g.:
this.listenTo(vent, 'user:delete', this.onUserDelete);
},
onUserDelete: function () {
// Let's create the notification, shall we?
this.info({
content: 'User is successfully deleted.'
});
}
});
```

In your template, create a div: `