Documentation

This commit is contained in:
James Barnsley
2018-11-21 21:43:26 +13:00
parent 063402197a
commit d9bffc9fd5
3 changed files with 21 additions and 32 deletions

View File

@ -61656,22 +61656,6 @@ var App = function (_React$Component) {
_reactRouter.hashHistory.push(global.baseURL + 'initial-setup');
}
}
/*
componentWillReceiveProps(nextProps){
// We've navigated to a new location
if (this.props.location.pathname !== nextProps.location.pathname){
// Scroll to bottom, only if we've PUSHed to a new route
// We also prevent scroll reset for any sub_view routes (like tabs, services, etc)
if (nextProps.location.action == 'PUSH' && nextProps.params.sub_view === undefined){
window.scrollTo(0, 0);
}
}
}
*/
}, {
key: 'shouldTriggerShortcut',
value: function shouldTriggerShortcut(e) {
@ -61708,6 +61692,17 @@ var App = function (_React$Component) {
return true;
}
}
/**
* Using Visibility API, detect whether the browser is in focus or not
*
* This is used to keep background requests lean, preventing a queue of requests building up
* for when focus is retained. Seems most obvious on mobile devices with Chrome as it has throttled
* quota significantly: https://developers.google.com/web/updates/2017/03/background_tabs
*
* @param e Event
**/
}, {
key: 'handleFocusAndBlur',
value: function handleFocusAndBlur(e) {

File diff suppressed because one or more lines are too long

View File

@ -130,21 +130,6 @@ class App extends React.Component{
}
}
/*
componentWillReceiveProps(nextProps){
// We've navigated to a new location
if (this.props.location.pathname !== nextProps.location.pathname){
// Scroll to bottom, only if we've PUSHed to a new route
// We also prevent scroll reset for any sub_view routes (like tabs, services, etc)
if (nextProps.location.action == 'PUSH' && nextProps.params.sub_view === undefined){
window.scrollTo(0, 0);
}
}
}
*/
shouldTriggerShortcut(e){
if (!this.props.shortkeys_enabled){
@ -180,6 +165,15 @@ class App extends React.Component{
}
}
/**
* Using Visibility API, detect whether the browser is in focus or not
*
* This is used to keep background requests lean, preventing a queue of requests building up
* for when focus is retained. Seems most obvious on mobile devices with Chrome as it has throttled
* quota significantly: https://developers.google.com/web/updates/2017/03/background_tabs
*
* @param e Event
**/
handleFocusAndBlur(e){
this.props.uiActions.setWindowFocus(document.hasFocus());
}