diff options
author | Wojtek Kosior <koszko@koszko.org> | 2021-12-22 16:39:34 +0100 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2021-12-22 16:39:34 +0100 |
commit | b590eaa2f64ead3384eadc6fe58f6358aa1a0478 (patch) | |
tree | 8f1e9403c1a75246c2a9a0afc4ab30706ea7afbe /content/repo_query.js | |
parent | b7378a9994724750198e0d165c575be8538334fb (diff) | |
download | browser-extension-b590eaa2f64ead3384eadc6fe58f6358aa1a0478.tar.gz browser-extension-b590eaa2f64ead3384eadc6fe58f6358aa1a0478.zip |
reworked build system; added missing license notices
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 |