<commit_before># notifications-js-pooling-consumer
A consumer for the [notifications](https://github.com/samfcmc/bennu-notifications) service that uses pooling

## Requirements
* Bower

## Installation
If you are using Bower to manage all the frontend dependencies in your project you can use it to install this library:
```shell
bower install notifications-js-pooling-consumer --save
```

## Usage
* Get a token from the notifications service (TODO)
* Include the library and create an instance of the consumer:
```javascript
var notifications = new Notifications(token);
```
Now you can start use several methods to handle notifications of a particular user

* Get last N notifications, where N the limit of notifications you get.

```javascript
notifications.getLastN(N, function(response) {
  // 'response' contains an array of notifications objects
}, function(error) {
  // Handle error
});
```

* Get all unread notifications

```javascript
notifications.unread(function(response) {
  // 'response' contains an array of unread notifications
}, function(error) {
  // Handle error
});
```

* Get all notifications that were created after a given one

```javascript
notifications.after(id, function(response) {
  /* 'response' contains an array of all notifications<commit_msg>Fixed error in readme<commit_after># notifications-js-pooling-consumer
A consumer for the [notifications](https://github.com/samfcmc/bennu-notifications) service that uses pooling

## Requirements
* Bower

## Installation
If you are using Bower to manage all the frontend dependencies in your project you can use it to install this library:
```shell
bower install notifications-js-pooling-consumer --save
```

## Usage
* Get a token from the notifications service (TODO)
* Include the library and create an instance of the consumer:
```javascript
var notifications = new Notifications(token);
```
Now you can start use several methods to handle notifications of a particular user

* Get last N notifications, where is N the limit of notifications you get.

```javascript
notifications.getLastN(N, function(response) {
  // 'response' contains an array of notifications objects
}, function(error) {
  // Handle error
});
```

* Get all unread notifications

```javascript
notifications.unread(function(response) {
  // 'response' contains an array of unread notifications
}, function(error) {
  // Handle error
});
```

* Get all notifications that were created after a given one

```javascript
notifications.after(id, function(response) {
  /* 'response' contains an array of all notifications
{'fraction_non_alphanumeric': 0.09398058252427184, 'fraction_numerical': 0.0, 'mean_word_length': 4.976798143851508, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6357548', 'n_tokens_mistral': 712, 'n_tokens_neox': 657, 'n_words': 283}