forked from tsolucio/corebos
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmassedit-worker.js
More file actions
20 lines (19 loc) · 783 Bytes
/
Copy pathmassedit-worker.js
File metadata and controls
20 lines (19 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
self.addEventListener('message', function (event) {
var sentForm = event.data;
if (sentForm['module']!=undefined) {
var thisp = this;
let sseaction = typeof(sentForm.SSE_SOURCE_ACTION) != 'undefined' ? sentForm.SSE_SOURCE_ACTION : 'MassEditSave';
var cbierels_es = new EventSource('index.php?module='+sentForm['module']+'&action='+sentForm['module']+'Ajax&file='+sseaction+'¶ms='+encodeURIComponent(JSON.stringify(sentForm)));
cbierels_es.addEventListener('message', function (event) {
var result = JSON.parse(event.data);
thisp.postMessage(result);
if (event.lastEventId == 'CLOSE') {
thisp.postMessage('CLOSE');
cbierels_es.close();
}
}, false);
cbierels_es.addEventListener('error', function (e) {
cbierels_es.close();
});
}
}, false);