diff --git a/assets/js/common/shorcuts.js b/assets/js/common/shorcuts.js index f8dd983a..ad1b0539 100644 --- a/assets/js/common/shorcuts.js +++ b/assets/js/common/shorcuts.js @@ -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 *