From 8ceea119a8287568439a2a9d167b333f74a47e21 Mon Sep 17 00:00:00 2001 From: supahgreg Date: Sat, 27 Apr 2013 11:01:54 -0500 Subject: [PATCH] Add JS PluginHost.HOOK_PARAMS_LOADED and PluginHost.HOOK_RUNTIME_INFO_LOADED to notify when interesting info has been created/updated. --- js/PluginHost.js | 2 ++ js/functions.js | 3 +++ js/tt-rss.js | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/js/PluginHost.js b/js/PluginHost.js index de4c57b6..668d215f 100644 --- a/js/PluginHost.js +++ b/js/PluginHost.js @@ -8,6 +8,8 @@ var PluginHost = { HOOK_FEED_LOADED: 5, HOOK_ARTICLE_EXPANDED: 6, HOOK_ARTICLE_COLLAPSED: 7, + HOOK_PARAMS_LOADED: 8, + HOOK_RUNTIME_INFO_LOADED: 9, hooks: [], register: function (name, callback) { if (typeof(this.hooks[name]) == 'undefined') diff --git a/js/functions.js b/js/functions.js index 87c52b70..8691c1ee 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1277,6 +1277,9 @@ function backend_sanity_check_callback(transport) { } init_params = params; + + // PluginHost might not be available on non-index pages + window.PluginHost && PluginHost.run(PluginHost.HOOK_PARAMS_LOADED, init_params); } sanity_check_done = true; diff --git a/js/tt-rss.js b/js/tt-rss.js index a7518959..2a741ab2 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -753,6 +753,8 @@ function parse_runtime_info(data) { init_params[k] = v; notify(''); } + + PluginHost.run(PluginHost.HOOK_RUNTIME_INFO_LOADED, data); } function collapse_feedlist() { @@ -992,7 +994,7 @@ function handle_rpc_json(transport, scheduled_call) { if (counters) parse_counters(counters, scheduled_call); - var runtime_info = reply['runtime-info'];; + var runtime_info = reply['runtime-info']; if (runtime_info) parse_runtime_info(runtime_info); -- 2.39.5