Comparing version 1.4.3 to 1.4.4
@@ -196,6 +196,35 @@ import { EventEmitter } from "eventemitter3"; | ||
} | ||
type PeerEvents = { | ||
/** | ||
* Emitted when a connection to the PeerServer is established. | ||
*/ | ||
open: (id: string) => void; | ||
/** | ||
* Emitted when a new data connection is established from a remote peer. | ||
*/ | ||
connection: (dataConnection: DataConnection) => void; | ||
/** | ||
* Emitted when a remote peer attempts to call you. | ||
*/ | ||
call: (mediaConnection: MediaConnection) => void; | ||
/** | ||
* Emitted when the peer is destroyed and can no longer accept or create any new connections. | ||
*/ | ||
close: () => void; | ||
/** | ||
* Emitted when the peer is disconnected from the signalling server | ||
*/ | ||
disconnected: (currentId: string) => void; | ||
/** | ||
* Errors on the peer are almost always fatal and will destroy the peer. | ||
*/ | ||
error: (error: Error) => void; | ||
}; | ||
/** | ||
* A peer who can initiate connections with other peers. | ||
*/ | ||
export class Peer extends EventEmitter { | ||
export class Peer extends EventEmitter<PeerEvents> { | ||
/** | ||
* The brokering ID of this peer | ||
*/ | ||
get id(): string; | ||
@@ -206,2 +235,3 @@ get options(): PeerOptions; | ||
/** | ||
* A hash of all connections associated with this peer, keyed by the remote peer's ID. | ||
* @deprecated | ||
@@ -211,15 +241,39 @@ * Return type will change from Object to Map<string,[]> | ||
get connections(): Object; | ||
/** | ||
* true if this peer and all of its connections can no longer be used. | ||
*/ | ||
get destroyed(): boolean; | ||
/** | ||
* false if there is an active connection to the PeerServer. | ||
*/ | ||
get disconnected(): boolean; | ||
constructor(id?: string | PeerOptions, options?: PeerOptions); | ||
/** | ||
* A peer can connect to other peers and listen for connections. | ||
*/ | ||
constructor(); | ||
/** | ||
* A peer can connect to other peers and listen for connections. | ||
* @param options for specifying details about PeerServer | ||
*/ | ||
constructor(options: PeerOptions); | ||
/** | ||
* A peer can connect to other peers and listen for connections. | ||
* @param id Other peers can connect to this peer using the provided ID. | ||
* If no ID is given, one will be generated by the brokering server. | ||
* @param options for specifying details about PeerServer | ||
*/ | ||
constructor(id: string, options?: PeerOptions); | ||
/** Retrieve messages from lost message store */ | ||
_getMessages(connectionId: string): ServerMessage[]; | ||
/** | ||
* Returns a DataConnection to the specified peer. See documentation for a | ||
* complete list of options. | ||
* Connects to the remote peer specified by id and returns a data connection. | ||
* @param peer The brokering ID of the remote peer (their peer.id). | ||
* @param options for specifying details about Peer Connection | ||
*/ | ||
connect(peer: string, options?: PeerConnectOption): DataConnection; | ||
/** | ||
* Returns a MediaConnection to the specified peer. See documentation for a | ||
* complete list of options. | ||
* Calls the remote peer specified by id and returns a media connection. | ||
* @param peer The brokering ID of the remote peer (their peer.id). | ||
* @param stream The caller's media stream | ||
* @param options Metadata associated with the connection, passed in by whoever initiated the connection. | ||
*/ | ||
@@ -226,0 +280,0 @@ call(peer: string, stream: MediaStream, options?: CallOption): MediaConnection; |
{ | ||
"name": "peerjs", | ||
"version": "1.4.3", | ||
"version": "1.4.4", | ||
"keywords": [ | ||
@@ -118,3 +118,6 @@ "peerjs", | ||
"main": { | ||
"source": "lib/exports.ts" | ||
"source": "lib/exports.ts", | ||
"sourceMap": { | ||
"inlineSources": true | ||
} | ||
}, | ||
@@ -125,3 +128,6 @@ "module": { | ||
"eventemitter3" | ||
] | ||
], | ||
"sourceMap": { | ||
"inlineSources": true | ||
} | ||
}, | ||
@@ -150,3 +156,3 @@ "browser-minified": { | ||
"watch": "parcel watch", | ||
"build": "rm -rf dist && parcel build && ln -s dist/peerjs.cjs dist/peerjs.js && ln -s dist/peerjs.min.cjs dist/peerjs.min.js", | ||
"build": "rm -rf dist && parcel build && cp dist/peerjs.cjs dist/peerjs.js && cp dist/peerjs.min.cjs dist/peerjs.min.js", | ||
"prepublishOnly": "npm run build", | ||
@@ -153,0 +159,0 @@ "test": "mocha -r ts-node/register -r jsdom-global/register test/**/*.ts", |
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
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
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
2587788
15
20896
6