aboutsummaryrefslogtreecommitdiff
path: root/content/activity_info_server.js
diff options
context:
space:
mode:
Diffstat (limited to 'content/activity_info_server.js')
-rw-r--r--content/activity_info_server.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/content/activity_info_server.js b/content/activity_info_server.js
index 8435377..a1384e9 100644
--- a/content/activity_info_server.js
+++ b/content/activity_info_server.js
@@ -11,6 +11,8 @@
* IMPORTS_START
* IMPORT listen_for_connection
* IMPORT CONNECTION_TYPE
+ * IMPORT set_repo_query_repos
+ * IMPORT set_repo_query_callback
* IMPORTS_END
*/
@@ -33,9 +35,22 @@ function report_script(script_data)
function report_settings(settings)
{
+ const [pattern, settings_data, repos] = settings;
+ set_repo_query_repos(repos);
+
report_activity("settings", settings);
}
+function report_repo_query_result(result)
+{
+ report_activity("repo_query_result", result);
+}
+
+function trigger_repo_query()
+{
+ set_repo_query_callback(report_repo_query_result);
+}
+
function new_connection(port)
{
console.log("new activity info connection!");
@@ -44,6 +59,14 @@ function new_connection(port)
for (const activity of activities)
port.postMessage(activity);
+
+ /*
+ * So far the only thing we expect to receive is repo query order. Once more
+ * possibilities arrive, we will need to complicate this listener.
+ */
+ port.onMessage.addListener(trigger_repo_query);
+
+ port.onDisconnect.addListener(() => ports.delete(port));
}
function start_activity_info_server()