react-utils.mjs (649B)
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 import React from "resource://devtools/client/shared/vendor/react.mjs"; 6 7 /** 8 * Create React factories for given arguments. 9 * Example: 10 * const { 11 * Tabs, 12 * TabPanel 13 * } = createFactories(ChromeUtils.importESModule("devtools/client/shared/components/tabs/Tabs.mjs")); 14 */ 15 export function createFactories(args) { 16 const result = {}; 17 for (const p in args) { 18 result[p] = React.createFactory(args[p]); 19 } 20 return result; 21 }