broken default param fix

This commit is contained in:
Tim Koepsel 2019-10-23 01:28:24 +02:00
parent 88a140e897
commit 528abb73a4
4 changed files with 882 additions and 863 deletions

14
dist/rage-rpc.d.ts vendored
View File

@ -2,13 +2,13 @@ export as namespace rpc;
export function register(name: string, cb: ProcedureListener): void; export function register(name: string, cb: ProcedureListener): void;
export function unregister(name: string): void; export function unregister(name: string): void;
export function call<T = any>(name: string, args?: any, options: CallOptions = {}): Promise<T>; export function call<T = any>(name: string, args?: any, options?: CallOptions): Promise<T>;
export function callServer<T = any>(name: string, args?: any, options: CallOptions = {}): Promise<T>; export function callServer<T = any>(name: string, args?: any, options?: CallOptions): Promise<T>;
export function callClient<T = any>(player: Player, name: string, args?: any, options: CallOptions = {}): Promise<T>; export function callClient<T = any>(player: Player, name: string, args?: any, options?: CallOptions): Promise<T>;
export function callClient<T = any>(name: string, args?: any, options: CallOptions = {}): Promise<T>; export function callClient<T = any>(name: string, args?: any, options?: CallOptions): Promise<T>;
export function callBrowsers<T = any>(player: Player, name: string, args?: any, options: CallOptions = {}): Promise<T>; export function callBrowsers<T = any>(player: Player, name: string, args?: any, options?: CallOptions): Promise<T>;
export function callBrowsers<T = any>(name: string, args?: any, options: CallOptions = {}): Promise<T>; export function callBrowsers<T = any>(name: string, args?: any, options?: CallOptions): Promise<T>;
export function callBrowser<T = any>(browser: Browser, name: string, args?: any, options: CallOptions = {}): Promise<T>; export function callBrowser<T = any>(browser: Browser, name: string, args?: any, options?: CallOptions): Promise<T>;
export function on(name: string, cb: ProcedureListener): void; export function on(name: string, cb: ProcedureListener): void;
export function off(name: string, cb: ProcedureListener): void; export function off(name: string, cb: ProcedureListener): void;

File diff suppressed because one or more lines are too long

1725
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -360,7 +360,7 @@ function _callBrowsers(player: Player, name: string, args?: any, extraData: any
* @param options - Any options. * @param options - Any options.
* @returns The result from the procedure. * @returns The result from the procedure.
*/ */
export function callBrowsers(player: Player | string, name?: string | any, args?: any, options: CallOptions = {}): Promise<any> { export function callBrowsers(player: Player | string, name?: string | any, args?: any, options?: CallOptions): Promise<any> {
let promise; let promise;
let extraData: any = {}; let extraData: any = {};
@ -397,7 +397,7 @@ export function callBrowsers(player: Player | string, name?: string | any, args?
* @param options - Any options. * @param options - Any options.
* @returns The result from the procedure. * @returns The result from the procedure.
*/ */
export function callBrowser(browser: Browser, name: string, args?: any, options: CallOptions = {}): Promise<any> { export function callBrowser(browser: Browser, name: string, args?: any, options?: CallOptions): Promise<any> {
if(environment !== 'client') return util.promiseReject('callBrowser can only be used in the client environment'); if(environment !== 'client') return util.promiseReject('callBrowser can only be used in the client environment');
if(arguments.length < 2 || arguments.length > 4) return util.promiseReject('callBrowser expects 2 to 4 arguments: "browser", "name", optional "args", and optional "options"'); if(arguments.length < 2 || arguments.length > 4) return util.promiseReject('callBrowser expects 2 to 4 arguments: "browser", "name", optional "args", and optional "options"');