Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@libp2p/interface

Package Overview
Dependencies
Maintainers
6
Versions
544
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/interface - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

dist/src/events.browser.d.ts

3

dist/src/events.d.ts

@@ -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

@@ -90,2 +90,6 @@ /**

signedPeerRecord?: SignedPeerRecord;
/**
* The connection that the identify protocol ran over
*/
connection: Connection;
}

@@ -92,0 +96,0 @@ /**

@@ -6,5 +6,18 @@ import type { Connection } from '../connection/index.js';

max?: number;
/**
* If true, invoke `onConnect` for this topology on transient (e.g. short-lived
* and/or data-limited) connections. (default: false)
*/
notifyOnTransient?: boolean;
/**
* Invoked when a new connection is opened to a peer that supports the
* registered protocol
*/
onConnect?(peerId: PeerId, conn: Connection): void;
/**
* Invoked when the last connection to a peer that supports the registered
* protocol closes
*/
onDisconnect?(peerId: PeerId): void;
}
//# sourceMappingURL=index.d.ts.map

@@ -64,2 +64,4 @@ {

"./events:CustomEvent": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.events.CustomEvent.html",
"setMaxListeners": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.events.setMaxListeners.html",
"./events:setMaxListeners": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.events.setMaxListeners.html",
"AbortOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.index.AbortOptions.html",

@@ -66,0 +68,0 @@ ".:AbortOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.index.AbortOptions.html",

7

package.json
{
"name": "@libp2p/interface",
"version": "0.1.4",
"version": "0.1.5",
"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": {

@@ -178,4 +181,4 @@ ".": {

"sinon": "^17.0.0",
"sinon-ts": "^1.0.0"
"sinon-ts": "^2.0.0"
}
}

@@ -1,3 +0,1 @@

# @libp2p/interface <!-- omit in toc -->
[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)

@@ -10,12 +8,4 @@ [![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)

## Table of contents <!-- omit in toc -->
# Install
- [Install](#install)
- [Browser `<script>` tag](#browser-script-tag)
- [API Docs](#api-docs)
- [License](#license)
- [Contribution](#contribution)
## Install
```console

@@ -25,3 +15,3 @@ $ npm i @libp2p/interface

### Browser `<script>` tag
## Browser `<script>` tag

@@ -34,7 +24,7 @@ Loading this module through a script tag will make it's exports available as `Libp2pInterface` in the global namespace.

## API Docs
# API Docs
- <https://libp2p.github.io/js-libp2p/modules/_libp2p_interface.html>
## License
# License

@@ -46,4 +36,4 @@ Licensed under either of

## Contribution
# Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

@@ -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
}
}

@@ -102,2 +102,7 @@ /**

signedPeerRecord?: SignedPeerRecord
/**
* The connection that the identify protocol ran over
*/
connection: Connection
}

@@ -104,0 +109,0 @@

@@ -8,4 +8,19 @@ import type { Connection } from '../connection/index.js'

/**
* If true, invoke `onConnect` for this topology on transient (e.g. short-lived
* and/or data-limited) connections. (default: false)
*/
notifyOnTransient?: boolean
/**
* Invoked when a new connection is opened to a peer that supports the
* registered protocol
*/
onConnect?(peerId: PeerId, conn: Connection): void
/**
* Invoked when the last connection to a peer that supports the registered
* protocol closes
*/
onDisconnect?(peerId: PeerId): void
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc