Project

General

Profile

« Previous | Next » 

Revision c483ae19

Added by koszko about 2 years ago

add ability to query page content from repo and display it in the popup

View differences:

content/activity_info_server.js
11 11
 * IMPORTS_START
12 12
 * IMPORT listen_for_connection
13 13
 * IMPORT CONNECTION_TYPE
14
 * IMPORT set_repo_query_repos
15
 * IMPORT set_repo_query_callback
14 16
 * IMPORTS_END
15 17
 */
16 18

  
......
33 35

  
34 36
function report_settings(settings)
35 37
{
38
    const [pattern, settings_data, repos] = settings;
39
    set_repo_query_repos(repos);
40

  
36 41
    report_activity("settings", settings);
37 42
}
38 43

  
44
function report_repo_query_result(result)
45
{
46
    report_activity("repo_query_result", result);
47
}
48

  
49
function trigger_repo_query()
50
{
51
    set_repo_query_callback(report_repo_query_result);
52
}
53

  
39 54
function new_connection(port)
40 55
{
41 56
    console.log("new activity info connection!");
......
44 59

  
45 60
    for (const activity of activities)
46 61
	port.postMessage(activity);
62

  
63
    /*
64
     * So far the only thing we expect to receive is repo query order. Once more
65
     * possibilities arrive, we will need to complicate this listener.
66
     */
67
    port.onMessage.addListener(trigger_repo_query);
68

  
69
    port.onDisconnect.addListener(() => ports.delete(port));
47 70
}
48 71

  
49 72
function start_activity_info_server()

Also available in: Unified diff