tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

RefreshDevicesButton.js (1395B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 const {
      8  createFactory,
      9  PureComponent,
     10 } = require("resource://devtools/client/shared/vendor/react.mjs");
     11 const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js");
     12 
     13 const FluentReact = require("resource://devtools/client/shared/vendor/fluent-react.js");
     14 const Localized = createFactory(FluentReact.Localized);
     15 
     16 const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.mjs");
     17 const Actions = require("resource://devtools/client/aboutdebugging/src/actions/index.js");
     18 
     19 class RefreshDevicesButton extends PureComponent {
     20  static get propTypes() {
     21    return {
     22      dispatch: PropTypes.func.isRequired,
     23      isScanning: PropTypes.bool.isRequired,
     24    };
     25  }
     26 
     27  refreshDevices() {
     28    this.props.dispatch(Actions.scanUSBRuntimes());
     29  }
     30 
     31  render() {
     32    return Localized(
     33      { id: "about-debugging-refresh-usb-devices-button" },
     34      dom.button(
     35        {
     36          className: "default-button qa-refresh-devices-button",
     37          disabled: this.props.isScanning,
     38          onClick: () => this.refreshDevices(),
     39        },
     40        "Refresh devices"
     41      )
     42    );
     43  }
     44 }
     45 
     46 module.exports = RefreshDevicesButton;