mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-04 12:14:12 +00:00 
			
		
		
		
	Add websocket shorcut
This commit is contained in:
		@@ -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
 | 
			
		||||
 * 
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user