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.js34
1 files changed, 12 insertions, 22 deletions
diff --git a/content/activity_info_server.js b/content/activity_info_server.js
index c1b9736..db8ff80 100644
--- a/content/activity_info_server.js
+++ b/content/activity_info_server.js
@@ -42,15 +42,10 @@
* proprietary program, I am not going to enforce this in court.
*/
-/*
- * IMPORTS_START
- * IMPORT listen_for_connection
- * IMPORT CONNECTION_TYPE
- * IMPORT repo_query
- * IMPORT subscribe_repo_query_results
- * IMPORT unsubscribe_repo_query_results
- * IMPORTS_END
- */
+#IMPORT common/connection_types.js AS CONNECTION_TYPE
+#IMPORT content/repo_query.js
+
+#FROM common/message_server.js IMPORT listen_for_connection
var activities = [];
var ports = new Set();
@@ -73,6 +68,7 @@ function report_script(script_data)
{
report_activity("script", script_data);
}
+#EXPORT report_script
function report_settings(settings)
{
@@ -80,11 +76,13 @@ function report_settings(settings)
Object.assign(settings_clone, settings)
report_activity("settings", settings_clone);
}
+#EXPORT report_settings
function report_document_type(is_html)
{
report_activity("is_html", is_html);
}
+#EXPORT report_document_type
function report_repo_query_action(update, port)
{
@@ -93,13 +91,13 @@ function report_repo_query_action(update, port)
function trigger_repo_query(query_specifier)
{
- repo_query(...query_specifier);
+ repo_query.query(...query_specifier);
}
function handle_disconnect(port, report_action)
{
ports.delete(port)
- unsubscribe_repo_query_results(report_action);
+ repo_query.unsubscribe_results(report_action);
}
function new_connection(port)
@@ -112,7 +110,7 @@ function new_connection(port)
port.postMessage(activity);
const report_action = u => report_repo_query_action(u, port);
- subscribe_repo_query_results(report_action);
+ repo_query.subscribe_results(report_action);
/*
* So far the only thing we expect to receive is repo query order. Once more
@@ -123,16 +121,8 @@ function new_connection(port)
port.onDisconnect.addListener(() => handle_disconnect(port, report_action));
}
-function start_activity_info_server()
+function start()
{
listen_for_connection(CONNECTION_TYPE.ACTIVITY_INFO, new_connection);
}
-
-/*
- * EXPORTS_START
- * EXPORT start_activity_info_server
- * EXPORT report_script
- * EXPORT report_settings
- * EXPORT report_document_type
- * EXPORTS_END
- */
+#EXPORT start