Project

General

Profile

« Previous | Next » 

Revision 261548ff

Added by koszko about 2 years ago

emply an sh-based build system; make some changes to blocking

View differences:

background/message_server.js
5 5
 * Redistribution terms are gathered in the `copyright' file.
6 6
 */
7 7

  
8
"use strict";
9

  
10
(() => {
11
    const browser = window.browser;
8
/*
9
 * IMPORTS_START
10
 * IMPORT browser
11
 * IMPORTS_END
12
 */
12 13

  
13
    var listeners = {};
14
var listeners = {};
14 15

  
15
    /* magic should be one of the constants from /common/connection_types.js */
16
/* magic should be one of the constants from /common/connection_types.js */
16 17

  
17
    function listen_for_connection(magic, cb)
18
    {
19
	listeners[magic] = cb;
20
    }
18
function listen_for_connection(magic, cb)
19
{
20
    listeners[magic] = cb;
21
}
21 22

  
22
    function raw_listen(port) {
23
	if (listeners[port.name] === undefined)
24
	    return;
23
function raw_listen(port)
24
{
25
    if (listeners[port.name] === undefined)
26
	return;
25 27

  
26
	listeners[port.name](port);
27
    }
28
    listeners[port.name](port);
29
}
28 30

  
29
    browser.runtime.onConnect.addListener(raw_listen);
31
browser.runtime.onConnect.addListener(raw_listen);
30 32

  
31
    window.listen_for_connection = listen_for_connection;
32
})();
33
/*
34
 * EXPORTS_START
35
 * EXPORT listen_for_connection
36
 * EXPORTS_END
37
 */

Also available in: Unified diff