diff options
Diffstat (limited to 'content/repo_query.js')
-rw-r--r-- | content/repo_query.js | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/content/repo_query.js b/content/repo_query.js index 3201159..5dd503d 100644 --- a/content/repo_query.js +++ b/content/repo_query.js @@ -41,15 +41,12 @@ * proprietary program, I am not going to enforce this in court. */ -/* - * IMPORTS_START - * IMPORT make_ajax_request - * IMPORT observables - * IMPORT TYPE_PREFIX - * IMPORT parse_json_with_schema - * IMPORT matchers - * IMPORTS_END - */ +#IMPORT common/observables.js + +#FROM common/ajax.js IMPORT make_ajax_request +#FROM common/stored_types.js IMPORT TYPE_PREFIX +#FROM common/sanitize_JSON.js IMPORT parse_json_with_schema +#FROM common/misc.js IMPORT matchers const paths = { [TYPE_PREFIX.PAGE]: "/pattern", @@ -71,6 +68,7 @@ function repo_query(prefix, item, repo_urls) for (const repo_url of repo_urls) perform_query_against(key, repo_url, results); } +#EXPORT repo_query AS query const page_schema = { pattern: matchers.nonempty_string, @@ -127,22 +125,16 @@ async function perform_query_against(key, repo_url, results) observables.broadcast(observable, broadcast_msg); } -function subscribe_repo_query_results(cb) +function subscribe_results(cb) { observables.subscribe(observable, cb); for (const [key, results] of queried_items.entries()) cb({prefix: key[0], item: key.substring(1), results}); } +#EXPORT subscribe_results -function unsubscribe_repo_query_results(cb) +function unsubscribe_results(cb) { observables.unsubscribe(observable, cb); } - -/* - * EXPORTS_START - * EXPORT repo_query - * EXPORT subscribe_repo_query_results - * EXPORT unsubscribe_repo_query_results - * EXPORTS_END - */ +#EXPORT unsubscribe_results |