From ae7b87bca976cce607fd0ef21bd1f7ba4ea62e3c Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 9 Mar 2021 17:01:22 +0300 Subject: [PATCH] add HOOK_HEADLINE_MUTATIONS, HOOK_HEADLINE_MUTATIONS_SYNCED --- js/Feeds.js | 2 +- js/Headlines.js | 4 ++++ js/PluginHost.js | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/js/Feeds.js b/js/Feeds.js index 33a1fa3dc..b14caeaf9 100644 --- a/js/Feeds.js +++ b/js/Feeds.js @@ -113,7 +113,7 @@ const Feeds = { this.hideOrShowFeeds(App.getInitParam("hide_read_feeds")); this._counters_prev = elems; - PluginHost.run(PluginHost.HOOK_COUNTERS_PROCESSED); + PluginHost.run(PluginHost.HOOK_COUNTERS_PROCESSED, elems); }, reloadCurrent: function(method) { if (this.getActive() != undefined) { diff --git a/js/Headlines.js b/js/Headlines.js index 28e43be1f..8d7e06f41 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -72,6 +72,8 @@ const Headlines = { } }); + PluginHost.run(PluginHost.HOOK_HEADLINE_MUTATIONS, mutations); + Headlines.updateSelectedPrompt(); if ('requestIdleCallback' in window) @@ -198,6 +200,8 @@ const Headlines = { console.log('requesting counters for', feeds, labels); Feeds.requestCounters(feeds, labels); } + + PluginHost.run(PluginHost.HOOK_HEADLINE_MUTATIONS_SYNCED, results); }); }, click: function (event, id, in_body) { diff --git a/js/PluginHost.js b/js/PluginHost.js index caee79d58..b54f1ece3 100644 --- a/js/PluginHost.js +++ b/js/PluginHost.js @@ -17,6 +17,8 @@ const PluginHost = { HOOK_HEADLINE_RENDERED: 12, HOOK_COUNTERS_RECEIVED: 13, HOOK_COUNTERS_PROCESSED: 14, + HOOK_HEADLINE_MUTATIONS: 15, + HOOK_HEADLINE_MUTATIONS_SYNCED: 16, hooks: [], register: function (name, callback) { if (typeof(this.hooks[name]) == 'undefined') @@ -25,7 +27,7 @@ const PluginHost = { this.hooks[name].push(callback); }, run: function (name, args) { - //console.warn('PluginHost::run ' + name); + //console.warn('PluginHost.run', name); if (typeof(this.hooks[name]) != 'undefined') for (let i = 0; i < this.hooks[name].length; i++) {