mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Add websocket shorcut
This commit is contained in:
parent
e286c6fa85
commit
7935f8a3ce
@ -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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user