db9beb887fd7d09b4079293376c00ca0ea02d775
2 // Copyright 2008 Grégory Burri
4 // This file is part of Euphorik.
6 // Euphorik is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
11 // Euphorik is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with Euphorik. If not, see <http://www.gnu.org/licenses/>.
19 // regroupe la partie communication client -> sevreur de euphorik.
22 * @param funError un fonction executé lors d'un réponse 'error' de la part du serveur, peut être redéfinit pour une requête.
24 euphorik
.Communication = function(util
, funError
) {
27 euphorik
.Communication
.prototype.getBase = function(action
) {
29 "header" : { "action" : action
, "version" : euphorik
.conf
.versionProtocole
}
33 euphorik
.Communication
.prototype.requete = function(action
, json
, funOk
, funError
, asynchrone
) {
34 if (asynchrone
=== undefined) {
35 asynchrone
= true; // asynchrone par défaut
38 var mess
= this.getbase(action
);
39 objectEach(json
, function(nom
, val
) {
48 data: { action : JSON
.stringify(mess
) }
51 if (data
.reply
=== "error") {
54 } else if (this.funError
) {