@libp2p/interface
Advanced tools
Comparing version 0.1.4-69581367 to 0.1.4-50442d7a
@@ -0,1 +1,3 @@ | ||
/// <reference types="node" /> | ||
import { setMaxListeners as nodeSetMaxListeners } from 'events'; | ||
export interface EventCallback<EventType> { | ||
@@ -40,2 +42,3 @@ (evt: EventType): void; | ||
export { TypedEventEmitter as EventEmitter }; | ||
export declare const setMaxListeners: typeof nodeSetMaxListeners; | ||
//# sourceMappingURL=events.d.ts.map |
@@ -0,1 +1,2 @@ | ||
import { setMaxListeners as nodeSetMaxListeners } from 'events'; | ||
/** | ||
@@ -68,2 +69,11 @@ * An implementation of a typed event target | ||
export { TypedEventEmitter as EventEmitter }; | ||
// create a setMaxListeners that doesn't break browser usage | ||
export const setMaxListeners = (n, ...eventTargets) => { | ||
try { | ||
nodeSetMaxListeners(n, ...eventTargets); | ||
} | ||
catch { | ||
// swallow error, gulp | ||
} | ||
}; | ||
//# sourceMappingURL=events.js.map |
{ | ||
"name": "@libp2p/interface", | ||
"version": "0.1.4-69581367", | ||
"version": "0.1.4-50442d7a", | ||
"description": "The interface implemented by a libp2p node", | ||
@@ -42,2 +42,5 @@ "license": "Apache-2.0 OR MIT", | ||
], | ||
"browser": { | ||
"events": "./dist/src/events.browser.js" | ||
}, | ||
"exports": { | ||
@@ -44,0 +47,0 @@ ".": { |
@@ -0,1 +1,3 @@ | ||
import { setMaxListeners as nodeSetMaxListeners } from 'events' | ||
export interface EventCallback<EventType> { (evt: EventType): void } | ||
@@ -120,1 +122,10 @@ export interface EventObject<EventType> { handleEvent: EventCallback<EventType> } | ||
export { TypedEventEmitter as EventEmitter } | ||
// create a setMaxListeners that doesn't break browser usage | ||
export const setMaxListeners: typeof nodeSetMaxListeners = (n, ...eventTargets) => { | ||
try { | ||
nodeSetMaxListeners(n, ...eventTargets) | ||
} catch { | ||
// swallow error, gulp | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
257878
134
6178