mirror of
https://github.com/fluencelabs/js-libp2p-interfaces
synced 2025-07-07 22:51:52 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
91dba97125 | |||
93d712bb0e | |||
ca520775eb | |||
ceb91c672e |
@ -1,3 +1,12 @@
|
|||||||
|
## [0.8.2](https://github.com/libp2p/js-interfaces/compare/v0.8.1...v0.8.2) (2021-01-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* event emitter types with local types ([#80](https://github.com/libp2p/js-interfaces/issues/80)) ([ca52077](https://github.com/libp2p/js-interfaces/commit/ca520775eb26f5ed501375fdb24ba698c9a8c8c8))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [0.8.1](https://github.com/libp2p/js-interfaces/compare/v0.8.0...v0.8.1) (2020-12-11)
|
## [0.8.1](https://github.com/libp2p/js-interfaces/compare/v0.8.0...v0.8.1) (2020-12-11)
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
[](http://libp2p.io/)
|
[](http://libp2p.io/)
|
||||||
[](http://webchat.freenode.net/?channels=%23libp2p)
|
[](http://webchat.freenode.net/?channels=%23libp2p)
|
||||||
[](https://discuss.libp2p.io)
|
[](https://discuss.libp2p.io)
|
||||||
|
[](https://codecov.io/gh/libp2p/js-libp2p-interfaces)
|
||||||
|
[](https://github.com/libp2p/js-libp2p-interfaces/actions?query=branch%3Amaster+workflow%3Aci+)
|
||||||
|
|
||||||
> Contains test suites and interfaces you can use to implement the various components of libp2p.
|
> Contains test suites and interfaces you can use to implement the various components of libp2p.
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "libp2p-interfaces",
|
"name": "libp2p-interfaces",
|
||||||
"version": "0.8.1",
|
"version": "0.8.2",
|
||||||
"description": "Interfaces for JS Libp2p",
|
"description": "Interfaces for JS Libp2p",
|
||||||
"leadMaintainer": "Jacob Heun <jacobheun@gmail.com>",
|
"leadMaintainer": "Jacob Heun <jacobheun@gmail.com>",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const debug = require('debug')
|
const debug = require('debug')
|
||||||
const { EventEmitter } = require('events')
|
/** @typedef {import('../types').EventEmitterFactory} Events */
|
||||||
|
/** @type Events */
|
||||||
|
const EventEmitter = require('events')
|
||||||
const errcode = require('err-code')
|
const errcode = require('err-code')
|
||||||
|
|
||||||
const { pipe } = require('it-pipe')
|
const { pipe } = require('it-pipe')
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const { EventEmitter } = require('events')
|
/** @typedef {import('../types').EventEmitterFactory} Events */
|
||||||
|
/** @type Events */
|
||||||
|
const EventEmitter = require('events')
|
||||||
|
|
||||||
const lp = require('it-length-prefixed')
|
const lp = require('it-length-prefixed')
|
||||||
|
|
||||||
|
18
src/types.ts
Normal file
18
src/types.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
export interface EventEmitterFactory {
|
||||||
|
new(): EventEmitter;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EventEmitter {
|
||||||
|
addListener(event: string | symbol, listener: (...args: any[]) => void);
|
||||||
|
on(event: string | symbol, listener: (...args: any[]) => void);
|
||||||
|
once(event: string | symbol, listener: (...args: any[]) => void);
|
||||||
|
removeListener(event: string | symbol, listener: (...args: any[]) => void);
|
||||||
|
off(event: string | symbol, listener: (...args: any[]) => void);
|
||||||
|
removeAllListeners(event?: string | symbol);
|
||||||
|
setMaxListeners(n: number);
|
||||||
|
getMaxListeners(): number;
|
||||||
|
listeners(event: string | symbol): Function[]; // eslint-disable-line @typescript-eslint/ban-types
|
||||||
|
rawListeners(event: string | symbol): Function[]; // eslint-disable-line @typescript-eslint/ban-types
|
||||||
|
emit(event: string | symbol, ...args: any[]): boolean;
|
||||||
|
listenerCount(event: string | symbol): number;
|
||||||
|
}
|
Reference in New Issue
Block a user