mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #4829 from legokichi/peer
Add PeerJs.Peer.off method
This commit is contained in:
@@ -42,11 +42,13 @@ var connection = peerById.connect("id", {
|
||||
|
||||
var call = peerById.call('callto-id', (<any>window).localStream);
|
||||
|
||||
peerById.on("open", ()=> console.log("open"));
|
||||
var openHandler=()=> console.log("open");
|
||||
peerById.on("open", openHandler);
|
||||
peerById.on("connection", (c)=> console.log("connection"));
|
||||
peerById.on("call", (media)=> console.log("call"));
|
||||
peerById.on("close", ()=> console.log("close"));
|
||||
peerById.on("disconnected", ()=> console.log("disconnected"));
|
||||
peerById.on("error", (err)=> console.log(err));
|
||||
peerById.off("open", openHandler);
|
||||
|
||||
var connection2 = peerById.getConnection(peerByOption, "callto-id");
|
||||
|
||||
Vendored
+9
@@ -33,6 +33,7 @@ declare module PeerJs{
|
||||
on(event: 'open', cb: ()=>void): void;
|
||||
on(event: 'close', cb: ()=>void): void;
|
||||
on(event: 'error', cb: (err: any)=>void): void;
|
||||
off(event: string, fn: Function, once?: boolean): void;
|
||||
dataChannel: RTCDataChannel;
|
||||
label: string;
|
||||
metadata: any;
|
||||
@@ -52,6 +53,7 @@ declare module PeerJs{
|
||||
on(event: 'stream', cb: (stream: any)=>void): void;
|
||||
on(event: 'close', cb: ()=>void): void;
|
||||
on(event: 'error', cb: (err: any)=>void): void;
|
||||
off(event: string, fn: Function, once?: boolean): void;
|
||||
open: boolean;
|
||||
metadata: any;
|
||||
peer: string;
|
||||
@@ -126,6 +128,13 @@ declare module PeerJs{
|
||||
* @param cb Callback Function
|
||||
*/
|
||||
on(event: 'error', cb: (err: any)=>void): void;
|
||||
/**
|
||||
* Remove event listeners.(EventEmitter3)
|
||||
* @param {String} event The event we want to remove.
|
||||
* @param {Function} fn The listener that we need to find.
|
||||
* @param {Boolean} once Only remove once listeners.
|
||||
*/
|
||||
off(event: string, fn: Function, once?: boolean): void;
|
||||
/**
|
||||
* Close the connection to the server, leaving all existing data and media connections intact.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user