bugfix/socket-reconnetion #29
@ -7,9 +7,9 @@
 | 
			
		||||
 | 
			
		||||
// MIT License
 | 
			
		||||
 | 
			
		||||
import {Schedule} from './schedule.js';
 | 
			
		||||
import {EventHandler} from "./event-handler.js";
 | 
			
		||||
import {Socket} from "./socket.js";
 | 
			
		||||
import { Schedule } from './schedule.js';
 | 
			
		||||
import { EventHandler } from "./event-handler.js";
 | 
			
		||||
import { Socket } from "./socket.js";
 | 
			
		||||
 | 
			
		||||
export class RESTClient {
 | 
			
		||||
    debug = false;
 | 
			
		||||
@ -25,7 +25,7 @@ export class RESTClient {
 | 
			
		||||
        });
 | 
			
		||||
        const result = await response.json();
 | 
			
		||||
        if (this.debug) {
 | 
			
		||||
            console.debug({url, params, result});
 | 
			
		||||
            console.debug({ url, params, result });
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
@ -41,7 +41,7 @@ export class RESTClient {
 | 
			
		||||
 | 
			
		||||
        const result = await response.json();
 | 
			
		||||
        if (this.debug) {
 | 
			
		||||
            console.debug({url, data, result});
 | 
			
		||||
            console.debug({ url, data, result });
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
@ -87,7 +87,7 @@ export class Chat extends EventHandler {
 | 
			
		||||
    call(method, ...args) {
 | 
			
		||||
        return new Promise((resolve, reject) => {
 | 
			
		||||
            try {
 | 
			
		||||
                const command = {method, args, message_id: this.generateUniqueId()};
 | 
			
		||||
                const command = { method, args, message_id: this.generateUniqueId() };
 | 
			
		||||
                this._promises[command.message_id] = resolve;
 | 
			
		||||
                this._socket.send(JSON.stringify(command));
 | 
			
		||||
            } catch (e) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user