mirror of
https://github.com/pierre42100/ComunicWeb
synced 2025-06-19 04:15:17 +00:00
Created conversations service file
This commit is contained in:
@ -73,6 +73,9 @@ ComunicWeb.components.conversations.manager = {
|
||||
ComunicWeb.components.conversations.chatWindows.openConversation(openedConversations[i]);
|
||||
}
|
||||
|
||||
//Intializate conversation service
|
||||
ComunicWeb.components.conversations.service.init();
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@ -86,7 +89,7 @@ ComunicWeb.components.conversations.manager = {
|
||||
//Create the button
|
||||
var addButton = createElem("button", targetElem);
|
||||
addButton.className = "btn btn-primary open-conversation-button";
|
||||
addButton.innerHTML = "Open a conversation";
|
||||
addButton.innerHTML = "Conversations";
|
||||
|
||||
|
||||
//Make button lives
|
||||
|
@ -7,5 +7,39 @@
|
||||
*/
|
||||
|
||||
ComunicWeb.components.conversations.service = {
|
||||
|
||||
/**
|
||||
* @var {Integer} intervalID The ID of the current service interval
|
||||
*/
|
||||
__intervalID: false,
|
||||
|
||||
/**
|
||||
* Initializate conversation service
|
||||
*
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
init: function(){
|
||||
|
||||
//Check if an interval already exists or not
|
||||
if(this.__intervalID)
|
||||
clearInterval(this.__intervalID); //Remove old interval
|
||||
|
||||
//Initializate interval
|
||||
this.__intervalID = setInterval(function(){
|
||||
ComunicWeb.components.conversations.service.call();
|
||||
}, 1500);
|
||||
ComunicWeb.common.cacheManager.registerInterval(this.__intervalID);
|
||||
|
||||
//Success
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Call this service
|
||||
*
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
call: function(){
|
||||
console.log("Conversation service called !");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user