Files
firefox/devtools/client/responsive.html/components/ReloadConditions.js
T
J. Ryan Stinnett 827f994b52 Bug 1428816 - Add RDM UI to control whether we reload. r=ochameau
This adds a menu to the RDM global toolbar to allow the user to control whether
the page reloads in response to various state changes.

This also changes the default behavior to _not_ reload, so that we avoid losing
changes that might have been made in DevTools.

MozReview-Commit-ID: 86h5cB5dify
2018-02-08 15:20:17 -06:00

50 lines
1.5 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { PureComponent, createFactory } = require("devtools/client/shared/vendor/react");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const Types = require("../types");
const { getStr } = require("../utils/l10n");
const ToggleMenu = createFactory(require("./ToggleMenu"));
class ReloadConditions extends PureComponent {
static get propTypes() {
return {
reloadConditions: PropTypes.shape(Types.reloadConditions).isRequired,
onChangeReloadCondition: PropTypes.func.isRequired,
};
}
render() {
let {
reloadConditions,
onChangeReloadCondition,
} = this.props;
return ToggleMenu({
id: "global-reload-conditions-menu",
items: [
{
id: "touchSimulation",
label: getStr("responsive.reloadConditions.touchSimulation"),
checked: reloadConditions.touchSimulation,
},
{
id: "userAgent",
label: getStr("responsive.reloadConditions.userAgent"),
checked: reloadConditions.userAgent,
},
],
label: getStr("responsive.reloadConditions.label"),
title: getStr("responsive.reloadConditions.title"),
onChange: onChangeReloadCondition,
});
}
}
module.exports = ReloadConditions;