Skip to content

Commit

Permalink
Merge pull request #1 from OrionNebula/flow
Browse files Browse the repository at this point in the history
Added Flow type definitions
  • Loading branch information
OrionNebula authored Jun 7, 2018
2 parents b60dd8d + 62f68d2 commit 079c622
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 3 deletions.
11 changes: 11 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[ignore]
.*/node_modules/.*
[include]

[libs]
flow-typed
[lints]

[options]

[strict]
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
*

# But not
!dist/**
!dist/**
# and
!flow-typed/**
21 changes: 21 additions & 0 deletions flow-typed/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// @flow

declare module 'events' {
declare class EventEmitter {
/**
* Invoke a listener only when a certain condition is satisfied.
* @param {string | Symbol} event The name of the event to listen to.
* @param {(...any) => boolean} predicate A function which validates the event data.
* @param {(...any) => void} listener A listener to the event.
*/
onWhen (event: string | Symbol, predicate: (...args: any[]) => boolean, listener: (...args: any[]) => void): void;

/**
* Invoke a listener the first time a certain condition is satisfied.
* @param {string | Symbol} event The name of the event to listen to.
* @param {(...any) => boolean} predicate A function which validates the event data.
* @param {(...any) => void} listener A listener to the event.
*/
onceWhen (event: string | Symbol, predicate: (...args: any[]) => boolean, listener: (...args: any[]) => void): void;
}
}
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "event-filter",
"version": "1.0.1",
"version": "1.0.2",
"description": "A package for filtering Node.js events. Your listeners only get executed when the specified predicate is satisfied.",
"main": "dist/index",
"typing": "dist/index",
Expand Down

0 comments on commit 079c622

Please sign in to comment.