Skip to content

Commit

Permalink
Reorder the extending section.
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Krueger committed Jul 22, 2017
1 parent 33362b2 commit a960849
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ Microscopic and speedy event emitter in ES2015.
e.off('event', fn)
```

Context binding for the event handler:
```javascript
e.on('event', handler.bind(context))
```

Run an event handler once:
```javascript
e.once('event', handler)
e.emit('event') // Ran event handler
e.emit('event') // Didn't run anything
```

Emitter can be extended:
```javascript
class Hello extends Emitter {
Expand All @@ -47,15 +59,3 @@ Microscopic and speedy event emitter in ES2015.

(new Hello()).emit('event', 'world')
```

Context binding for the event handler:
```javascript
e.on('event', handler.bind(context))
```

Run an event handler once:
```javascript
e.once('event', handler)
e.emit('event') // Ran event handler
e.emit('event') // Didn't run anything
```

0 comments on commit a960849

Please sign in to comment.