feat: genericize makeAction

This commit is contained in:
Jeremy Kahn 2022-08-14 17:23:05 -05:00
parent 638587f5a3
commit 4eb1d05b92

View File

@ -25,20 +25,18 @@ declare module 'trystero' {
export type RoomConfig = BaseRoomConfig & export type RoomConfig = BaseRoomConfig &
(BitTorrentRoomConfig | FirebaseRoomConfig | IpfsRoomConfig) (BitTorrentRoomConfig | FirebaseRoomConfig | IpfsRoomConfig)
export type PeerActionData = any
export interface Room { export interface Room {
makeAction: ( makeAction: <T>(
namespace: string namespace: string
) => [ ) => [
( (
data: PeerActionData, data: T,
targetPeers?: string[], targetPeers?: string[],
metadata?: Record, metadata?: Record,
progress: (percent: number, peerId: string) => void progress: (percent: number, peerId: string) => void
) => void, ) => void,
(data: PeerActionData, peerId: string, metadata?: Record) => void, (data: T, peerId: string, metadata?: Record) => void,
(percent: number, peerId: string, metadata?: Record) => void (percent: number, peerId: string, metadata?: Record) => void
] ]