tor-browser

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

react-utils.js (864B)


      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 "use strict";
      5 
      6 // Make this available to both AMD and CJS environments
      7 define(function (require, exports, module) {
      8  // Dependencies
      9  const React = require("resource://devtools/client/shared/vendor/react.mjs");
     10 
     11  /**
     12   * Create React factories for given arguments.
     13   * Example:
     14   *   const {
     15   *     Tabs,
     16   *     TabPanel
     17   *   } = createFactories(ChromeUtils.importESModule("devtools/client/shared/components/tabs/Tabs.mjs"));
     18   */
     19  function createFactories(args) {
     20    const result = {};
     21    for (const p in args) {
     22      result[p] = React.createFactory(args[p]);
     23    }
     24    return result;
     25  }
     26 
     27  module.exports = {
     28    createFactories,
     29  };
     30 });