<commit_before>angular-pubsub
==============

**Simple pubsub service for angularJS**

### Dependencies

* angular 1.3+

# Installing angular-pubsub

Download the [latest version](https://raw.github.com/glepretre/angular-pubsub/master/dist/angular-pubsub.js)

or install it with Bower:

    bower install angular-pubsub

Then include it:

```html
<script src='angular-pubsub.js'></script>
```

When using [Require.JS](http://requirejs.org/):

```javascript
define(['angular-pubsub'], function(angularPubsub) {
  // Write good code here
});
```

## Include it into your app

```javascript
angular.module('myApp',['angularPubsub']);
```

Then where you need it :

```javascript
angular.module('myApp').controller('myAppCtrl',['PubSub', function (Pubsub) {
  // Do awesome things with
}]);
```

# Using angular-pubsub

angular-pubsub provides 3 methods :
* subscribe()
* publish()
* unsubscribe()

## Subscribing to a topic

The client (controller in most cases) which needs to receive messages has to
subscribe to a specific topic:

```javascript
PubSub.subscribe(topic, callback);
```


- 'topic' must be a string describing a topic/event (BUS name)
- 'callback' must be a function, the callback executed when receiving a message

## Publishing into a topic

```javascript
PubSub.publish(topic, other, parameters);
```

- 'other', 'parameters' : publish accept parameters

## Unsubscribing from a topic

When the client does not need to receive messages anymore,
and to avoid memory leaks, it is recommended to unsubscribe.

```javascript
PubSub.unsubscribe(topic, callbackToUnregister);
```
- 'callbackToUnregister' must be strictly equal to the registered callback.

# Tests

Tests are based on Karma-runner and implemented with Jasmine 2.

* [Karma-runner](https://karma-runner.github.io/)
* [Jasmine](https://jasmine.github.io/)

angular-pubsub is tested on stable versions of Chrome, Firefox and PhantomJS.

# Contribute!

Feedback and contributions are welcomed.

## Tests

    npm install<commit_msg>Use JSDoc syntax<commit_after>angular-pubsub
==============

**Simple pubsub service for angularJS**

### Dependencies

* angular 1.3+

# Installing angular-pubsub

Download the [latest version](https://raw.github.com/glepretre/angular-pubsub/master/dist/angular-pubsub.js)

or install it with Bower:

    bower install angular-pubsub

Then include it:

```html
<script src='angular-pubsub.js'></script>
```

When using [Require.JS](http://requirejs.org/):

```javascript
define(['angular-pubsub'], function(angularPubsub) {
  // Write good code here
});
```

## Include it into your app

```javascript
angular.module('myApp',['angularPubsub']);
```

Then where you need it :

```javascript
angular.module('myApp').controller('myAppCtrl',['PubSub', function (Pubsub) {
  // Do awesome things with
}]);
```

# Using angular-pubsub

angular-pubsub provides 3 methods :
* subscribe()
* publish()
* unsubscribe()

## Subscribing to a topic

The client (controller in most cases) which needs to receive messages has to
subscribe to a specific topic:

```javascript
PubSub.subscribe(topic, callback);
```

- `topic` - `{string}` - Name of the topic/event (BUS name)
- `callback` - `{function}` - Function to call when receiving a message

## Publishing into a topic

```javascript
PubSub.publish(topic, args);
```

- `args` - `{*}` - Optional one or more arguments
  which will be passed onto the subscribed clients

## Unsubscribing from a topic

When the client does not need to receive messages anymore,
and to avoid memory leaks, it is recommended to unsubscribe.

```javascript
PubSub.unsubscribe(topic, callbackToUnregister);
```
- `callbackToUnregister` - `{function}` - Registered `callback`

# Tests

Tests are based on Karma-runner and implemented with Jasmine 2.

* [Karma-runner](https://karma-runner.github.io/)
* [Jasmine](https://jasmine.github.io/)

angular-pubsub is tested on stable versions of Chrome, Firefox and PhantomJS.

# Contribute!

Feedback and contributions are welcomed.

## Tests

    npm install
{'fraction_non_alphanumeric': 0.1350881549540601, 'fraction_numerical': 0.0019865905140302956, 'mean_word_length': 4.746077032810271, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1803883', 'n_tokens_mistral': 1241, 'n_tokens_neox': 1180, 'n_words': 393}