1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 01:36:30 +00:00

reduce overhead in hash set/get

This commit is contained in:
Andrew Dolgov
2021-03-06 22:41:46 +03:00
parent 7b0b5b55c7
commit 1d9fa2a42e
3 changed files with 21 additions and 21 deletions

View File

@@ -236,12 +236,12 @@ const Feeds = {
//document.onkeypress = (event) => { return App.hotkeyHandler(event) };
window.onresize = () => { Headlines.scrollHandler(); }
/* global hash_get */
const hash_feed_id = hash_get('f');
const hash_feed_is_cat = hash_get('c') == "1";
const hash = App.Hash.get();
if (hash_feed_id != undefined) {
this.open({feed: hash_feed_id, is_cat: hash_feed_is_cat});
console.log('got hash', hash);
if (hash.f != undefined) {
this.open({feed: parseInt(hash.f), is_cat: parseInt(hash.c)});
} else {
this.openDefaultFeed();
}
@@ -305,9 +305,12 @@ const Feeds = {
setActive: function(id, is_cat) {
console.log('setActive', id, is_cat);
/* global hash_set */
hash_set('f', id);
hash_set('c', is_cat ? 1 : 0);
if ('requestIdleCallback' in window)
window.requestIdleCallback(() => {
App.Hash.set({f: id, c: is_cat ? 1 : 0});
});
else
App.Hash.set({f: id, c: is_cat ? 1 : 0});
this._active_feed_id = id;
this._active_feed_is_cat = is_cat;