Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanis Benson committed Jun 14, 2019
1 parent 09ae976 commit 9ace582
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions readme.md
Expand Up @@ -106,6 +106,16 @@ If `eventName` is given, only the listeners for that event are cleared.

The number of listeners for the `eventName` or all events if not specified.

#### bindMethods(target, [methodNames])

Bind the given `methodNames`, or all `Emittery` methods if `methodNames` is not defined, into the `target` object.

```js
import Emittery = require('emittery');
let object = {};
new Emittery().bindMethods(object);
```

## TypeScript

Definition for `emittery` and `emittery/legacy` are included. Use `import Emittery = require('emittery')` or `import Emittery = require('emittery/legacy')` to load the desired implementation.
Expand All @@ -123,6 +133,20 @@ ee.emit('value', 1); // TS compilation error
ee.emit('end'); // TS compilation error
```

### Emittery.mixin(emitteryPropertyName, [methodNames])
A decorator which mixins `Emittery` as property `emitteryPropertyName` and `methodNames`, or all `Emittery` methods if `methodNames` is not defined, into the target class.

```ts
import Emittery = require('emittery');

@Emittery.mixin('emittery')
class MyClass {}

let instance = new MyClass();

instance.on('event', () => {
});
```

## Scheduling details

Expand Down

0 comments on commit 9ace582

Please sign in to comment.