import { getRemoteOrThrow , IS_SERVER , waitForRemote } from "../internal" ; /**
 * Interface for client listening events
 */ export interface ClientListenerEvent < CallArguments extends ReadonlyArray < unknown > > { param callback Connect ( callback ) : RBXScriptConnection ; } /**
 * Interface for client sender events
 */ export interface ClientSenderEvent < CallArguments extends ReadonlyArray < unknown > > { param args SendToServer ( ... args ) : void ; } class ClientEvent < ConnectArgs extends ReadonlyArray < unknown > = Array < unknown > , CallArguments extends ReadonlyArray < unknown > = Array < unknown > > implements ClientListenerEvent < ConnectArgs > , ClientSenderEvent < CallArguments > { private instance : RemoteEvent ; public constructor ( name ) { this . instance = getRemoteOrThrow ( "RemoteEvent" , name ) ; assert ( ! IS_SERVER , "Cannot fetch NetClientEvent on the server!" ) ; } deprecated public GetInstance ( ) { return this . instance ; } public static Wait < ConnectArgs extends ReadonlyArray < unknown > = Array < unknown > , CallArguments extends ReadonlyArray < unknown > = Array < unknown > > ( name ) { return Promise . defer < ClientEvent < ConnectArgs , CallArguments > > ( async ( resolve ) => { await waitForRemote ( "RemoteEvent" , name , 60 ) ; resolve ( new ClientEvent ( name ) ) ; } ) ; } public SendToServer ( ... args ) { this . instance . FireServer ( ... args ) ; } public Connect ( callback ) { return this . instance . OnClientEvent . Connect ( callback ) ; } } export default ClientEvent ;