Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Commit

Permalink
Merge branch 'release/4.2.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
Olical committed Sep 30, 2014
2 parents 4ad612d + db0faf6 commit 19afbbc
Show file tree
Hide file tree
Showing 10 changed files with 1,400 additions and 1,400 deletions.
928 changes: 464 additions & 464 deletions EventEmitter.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions EventEmitter.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 28 additions & 28 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"name": "eventEmitter",
"description": "Event based JavaScript for the browser",
"version": "4.2.8",
"main": [
"./EventEmitter.js"
],
"author": {
"name": "Oliver Caldwell",
"web": "http://oli.me.uk/"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/Wolfy87/EventEmitter#license-mit"
}
],
"keywords": [
"events",
"structure"
],
"ignore": [
"docs",
"tests",
"tools",
".gitignore",
"package.json"
]
}
"name": "eventEmitter",
"description": "Event based JavaScript for the browser",
"version": "4.2.9",
"main": [
"./EventEmitter.js"
],
"author": {
"name": "Oliver Caldwell",
"web": "http://oli.me.uk/"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/Wolfy87/EventEmitter#license-mit"
}
],
"keywords": [
"events",
"structure"
],
"ignore": [
"docs",
"tests",
"tools",
".gitignore",
"package.json"
]
}
14 changes: 7 additions & 7 deletions component.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "eventEmitter",
"repo": "Wolfy87/EventEmitter",
"description": "Event based JavaScript for the browser.",
"version": "4.2.8",
"scripts": ["EventEmitter.js"],
"main": "EventEmitter.js",
"license": "MIT"
"name": "eventEmitter",
"repo": "Wolfy87/EventEmitter",
"description": "Event based JavaScript for the browser.",
"version": "4.2.9",
"scripts": ["EventEmitter.js"],
"main": "EventEmitter.js",
"license": "MIT"
}
54 changes: 27 additions & 27 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ I love AMD, so I implemented it in EventEmitter. If the script is loaded into a

```javascript
require(['EventEmitter'], function(EventEmitter) {
var ee = new EventEmitter();
var ee = new EventEmitter();
});
```

Expand Down Expand Up @@ -109,7 +109,7 @@ A listener is a function that is executed when an event is emitted. You can add

```javascript
function listener() {
console.log('The foo event has been emitted.');
console.log('The foo event has been emitted.');
}

ee.addListener('foo', listener);
Expand All @@ -119,11 +119,11 @@ You can also add in bulk using the `addListeners` method (notice the "s" on the

```javascript
function listener1() {
console.log('ONE');
console.log('ONE');
}

function listener2() {
console.log('TWO');
console.log('TWO');
}

ee.addListeners('foo', [listener1, listener2]);
Expand All @@ -133,20 +133,20 @@ The second way of calling addListeners involves passing an object of event names

```javascript
function listener1() {
console.log('ONE');
console.log('ONE');
}

function listener2() {
console.log('TWO');
console.log('TWO');
}

function listener3() {
console.log('THREE');
console.log('THREE');
}

ee.addListeners({
foo: [listener1, listener2],
bar: listener3
foo: [listener1, listener2],
bar: listener3
});
```

Expand All @@ -156,7 +156,7 @@ This works in the _exact_ same way as adding listeners. The only difference is t

```javascript
function listener() {
console.log('The foo event has been emitted.');
console.log('The foo event has been emitted.');
}

ee.addListener('foo', listener);
Expand All @@ -167,15 +167,15 @@ If you want a listener to remove itself after it has been called or after a cond

```javascript
function listener1() {
// If a condition is met then remove the listener
if(completed) {
return true;
}
// If a condition is met then remove the listener
if(completed) {
return true;
}
}

function listener2() {
// Always remove after use
return true;
// Always remove after use
return true;
}

ee.addListeners('foo', [listener1, listener2]);
Expand All @@ -186,8 +186,8 @@ If you do not want to, or can't for some reason, return true, you can set the re

```javascript
function listener() {
// Always remove after use
return 'REMOVE-ME';
// Always remove after use
return 'REMOVE-ME';
}

ee.addListener('foo', listener);
Expand All @@ -199,7 +199,7 @@ Alternatively you can use the `addOnceListener` method, or it's alias, `once`.

```javascript
function listener() {
// Do stuff
// Do stuff
}

ee.addOnceListener('foo', listener);
Expand All @@ -214,11 +214,11 @@ You can also remove whole events and all of their attached listeners with the `r

```javascript
function listener1() {
console.log('ONE');
console.log('ONE');
}

function listener2() {
console.log('TWO');
console.log('TWO');
}

ee.addListeners('foo', [listener1, listener2]);
Expand All @@ -233,11 +233,11 @@ If you really need to then you can get an array of all listeners attached to an

```javascript
function listener1() {
console.log('ONE');
console.log('ONE');
}

function listener2() {
console.log('TWO');
console.log('TWO');
}

ee.addListeners('foo', [listener1, listener2]);
Expand All @@ -250,11 +250,11 @@ So once you have added your listeners and you are ready to start executing them,

```javascript
function listener1() {
console.log('ONE');
console.log('ONE');
}

function listener2() {
console.log('TWO');
console.log('TWO');
}

ee.addListeners('foo', [listener1, listener2]);
Expand All @@ -265,7 +265,7 @@ For more control, you can pass an arguments array as the second argument. This a

```javascript
function adder(a, b) {
console.log(a + b);
console.log(a + b);
}

ee.addListener('addStuff', adder);
Expand Down Expand Up @@ -295,7 +295,7 @@ By defined I mean, it has to have some other listener added to it, or you have t
```javascript
ee.defineEvents(['bar', 'baz']);
ee.addListener(/ba[rz]/, function () {
console.log('Now you are thinking with regular expressions.');
console.log('Now you are thinking with regular expressions.');
});
ee.emitEvent(/ba[rz]/);
```
78 changes: 39 additions & 39 deletions docs/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,43 @@ dust.helper = require('../node_modules/dustjs-helpers');

// Load the rendered template
fs.readFile('docs/api.dust.js', function(err, data) {
// Throw any errors
if(err) {
throw err;
}

// Load the rendered template into dust
dust.loadSource(data);

// Load the data
fs.readFile('docs/data.json', function(err, rawJSON) {
// Throw any errors
if(err) {
throw err;
}

// Parse the JSON
var raw = JSON.parse(rawJSON);

// Build the data array
var data = [];

// Loop over all JSDoc block
for(var i = 0; i < raw.length; i += 1) {
if (!raw[i].isPrivate && !raw[i].ignore) {
data.push(raw[i]);
}
}

// Pipe the data into the template
dust.render('api', data, function(err, out) {
// Throw any errors
if(err) {
throw err;
}

// Write the data to the output
fs.writeFile('docs/api.md', out);
});
});
// Throw any errors
if(err) {
throw err;
}

// Load the rendered template into dust
dust.loadSource(data);

// Load the data
fs.readFile('docs/data.json', function(err, rawJSON) {
// Throw any errors
if(err) {
throw err;
}

// Parse the JSON
var raw = JSON.parse(rawJSON);

// Build the data array
var data = [];

// Loop over all JSDoc block
for(var i = 0; i < raw.length; i += 1) {
if (!raw[i].isPrivate && !raw[i].ignore) {
data.push(raw[i]);
}
}

// Pipe the data into the template
dust.render('api', data, function(err, out) {
// Throw any errors
if(err) {
throw err;
}

// Write the data to the output
fs.writeFile('docs/api.md', out);
});
});
});
Loading

0 comments on commit 19afbbc

Please sign in to comment.