Add websocket shorcut

This commit is contained in:
Pierre HUBERT 2020-03-31 16:27:41 +02:00
parent e286c6fa85
commit 7935f8a3ce

View File

@ -17,6 +17,21 @@ function api(uri, args, withLogin){
return ComunicWeb.common.api.exec(uri, args, withLogin);
}
/**
* Perform a requests through the WebSocket
*
* @param {String} title The title of the request
* @param {Object} data Data to include to request
* @return {Promise}
*/
function ws(title, data = {}) {
if(typeof data != "object")
throw new Error("Invalid data for websocket request!");
return UserWebSocket.SendRequest(title, data);
}
/**
* Create a quick language access function shorcut
*