diff --git a/app/templates/base.html.j2 b/app/templates/base.html.j2
index a3206a90..6e93183a 100644
--- a/app/templates/base.html.j2
+++ b/app/templates/base.html.j2
@@ -38,41 +38,29 @@
var jobsSubscribers = [];
var socket = io();
-
+ socket.emit('subscribe_user_ressources');
socket.on('init-corpora', function(msg) {
- var subscriber;
-
corpora = JSON.parse(msg);
- for (subscriber of corporaSubscribers) {subscriber._init(corpora);}
+ for (let subscriber of corporaSubscribers) {subscriber._init(corpora);}
});
-
-
socket.on('init-jobs', function(msg) {
- var subscriber;
-
jobs = JSON.parse(msg);
- for (subscriber of jobsSubscribers) {subscriber._init(jobs);}
+ for (let subscriber of jobsSubscribers) {subscriber._init(jobs);}
});
-
-
socket.on('update-corpora', function(msg) {
- var patch, patchedCorpora, subscriber;
+ var patch;
patch = JSON.parse(msg);
corpora = jsonpatch.apply_patch(corpora, patch);
- for (subscriber of corporaSubscribers) {subscriber._update(patch);}
+ for (let subscriber of corporaSubscribers) {subscriber._update(patch);}
});
-
-
socket.on('update-jobs', function(msg) {
- var patch, patchedJobs, subscriber;
+ var patch;
patch = JSON.parse(msg);
jobs = jsonpatch.apply_patch(jobs, patch);
- for (subscriber of jobsSubscribers) {subscriber._update(patch);}
+ for (let subscriber of jobsSubscribers) {subscriber._update(patch);}
});
-
-
socket.on('message', function(msg) {
console.log(msg);
});
@@ -83,38 +71,27 @@
var foreignJobs;
var foreignJobsSubscribers = [];
-
socket.on('init-foreign-corpora', function(msg) {
- var subscriber;
-
foreignCorpora = JSON.parse(msg);
- for (subscriber of foreignCorporaSubscribers) {subscriber._init(foreignCorpora);}
+ for (let subscriber of foreignCorporaSubscribers) {subscriber._init(foreignCorpora);}
});
-
-
socket.on('init-foreign-jobs', function(msg) {
- var subscriber;
-
foreignJobs = JSON.parse(msg);
- for (subscriber of foreignJobsSubscribers) {subscriber._init(foreignJobs);}
+ for (let subscriber of foreignJobsSubscribers) {subscriber._init(foreignJobs);}
});
-
-
socket.on('update-foreign-corpora', function(msg) {
- var patch, patchedCorpora, subscriber;
+ var patch;
patch = JSON.parse(msg);
foreignCorpora = jsonpatch.apply_patch(foreignCorpora, patch);
- for (subscriber of foreignCorporaSubscribers) {subscriber._update(patch);}
+ for (let subscriber of foreignCorporaSubscribers) {subscriber._update(patch);}
});
-
-
socket.on('update-foreign-jobs', function(msg) {
- var patch, patchedJobs, subscriber;
+ var patch;
patch = JSON.parse(msg);
foreignJobs = jsonpatch.apply_patch(foreignJobs, patch);
- for (subscriber of foreignJobsSubscribers) {subscriber._update(patch);}
+ for (let subscriber of foreignJobsSubscribers) {subscriber._update(patch);}
});