* it feels weird for requireIdleCallback() to be optional while more
modern browser features are required * simplify browser startup feature check a bit
This commit is contained in:
parent
84fe383ed4
commit
143617afb1
11
js/App.js
11
js/App.js
|
@ -688,15 +688,16 @@ const App = {
|
||||||
checkBrowserFeatures: function() {
|
checkBrowserFeatures: function() {
|
||||||
let errorMsg = "";
|
let errorMsg = "";
|
||||||
|
|
||||||
['MutationObserver'].forEach(function(wf) {
|
['MutationObserver', 'requestIdleCallback'].forEach((t) => {
|
||||||
if (!(wf in window)) {
|
if (!(t in window)) {
|
||||||
errorMsg = `Browser feature check failed: <code>window.${wf}</code> not found.`;
|
errorMsg = `Browser check failed: <code>window.${t}</code> not found.`;
|
||||||
throw new Error(errorMsg);
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (errorMsg) {
|
if (typeof Promise.allSettled == "undefined") {
|
||||||
this.Error.fatal(errorMsg, {info: navigator.userAgent});
|
errorMsg = `Browser check failed: <code>Promise.allSettled</code> is not defined.`;
|
||||||
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return errorMsg == "";
|
return errorMsg == "";
|
||||||
|
|
|
@ -311,12 +311,9 @@ const Feeds = {
|
||||||
setActive: function(id, is_cat) {
|
setActive: function(id, is_cat) {
|
||||||
console.log('setActive', id, is_cat);
|
console.log('setActive', id, is_cat);
|
||||||
|
|
||||||
if ('requestIdleCallback' in window)
|
window.requestIdleCallback(() => {
|
||||||
window.requestIdleCallback(() => {
|
|
||||||
App.Hash.set({f: id, c: is_cat ? 1 : 0});
|
|
||||||
});
|
|
||||||
else
|
|
||||||
App.Hash.set({f: id, c: is_cat ? 1 : 0});
|
App.Hash.set({f: id, c: is_cat ? 1 : 0});
|
||||||
|
});
|
||||||
|
|
||||||
this._active_feed_id = id;
|
this._active_feed_id = id;
|
||||||
this._active_feed_is_cat = is_cat;
|
this._active_feed_is_cat = is_cat;
|
||||||
|
|
|
@ -76,12 +76,9 @@ const Headlines = {
|
||||||
|
|
||||||
Headlines.updateSelectedPrompt();
|
Headlines.updateSelectedPrompt();
|
||||||
|
|
||||||
if ('requestIdleCallback' in window)
|
window.requestIdleCallback(() => {
|
||||||
window.requestIdleCallback(() => {
|
|
||||||
Headlines.syncModified(modified);
|
|
||||||
});
|
|
||||||
else
|
|
||||||
Headlines.syncModified(modified);
|
Headlines.syncModified(modified);
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
syncModified: function (modified) {
|
syncModified: function (modified) {
|
||||||
const ops = {
|
const ops = {
|
||||||
|
@ -175,7 +172,7 @@ const Headlines = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Promise.all(promises).then((results) => {
|
Promise.allSettled(promises).then((results) => {
|
||||||
let feeds = [];
|
let feeds = [];
|
||||||
let labels = [];
|
let labels = [];
|
||||||
|
|
||||||
|
|
|
@ -510,12 +510,10 @@ const Helpers = {
|
||||||
search: function() {
|
search: function() {
|
||||||
this.search_query = this.attr('value').search.toLowerCase();
|
this.search_query = this.attr('value').search.toLowerCase();
|
||||||
|
|
||||||
if ('requestIdleCallback' in window)
|
window.requestIdleCallback(() => {
|
||||||
window.requestIdleCallback(() => {
|
|
||||||
this.render_contents();
|
|
||||||
});
|
|
||||||
else
|
|
||||||
this.render_contents();
|
this.render_contents();
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
render_contents: function() {
|
render_contents: function() {
|
||||||
const container = dialog.domNode.querySelector(".contents");
|
const container = dialog.domNode.querySelector(".contents");
|
||||||
|
|
Loading…
Reference in New Issue