/* 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/>. */
import React from "devtools/client/shared/vendor/react"; import {
bindActionCreators,
combineReducers,
} from "devtools/client/shared/vendor/redux"; import ReactDOM from "devtools/client/shared/vendor/react-dom"; const {
Provider,
} = require("resource://devtools/client/shared/vendor/react-redux.js");
import ToolboxProvider from "devtools/client/framework/store-provider"; import flags from "devtools/shared/flags"; const {
registerStoreObserver,
} = require("resource://devtools/client/shared/redux/subscriber.js");
export function bootstrapWorkers(panelWorkers) { // The panel worker will typically be the source map and parser workers. // Both will be managed by the toolbox.
gWorkers = {
prettyPrintWorker: new PrettyPrintDispatcher(),
searchWorker: new SearchDispatcher(),
}; return { ...panelWorkers, ...gWorkers };
}
export function teardownWorkers() {
gWorkers.prettyPrintWorker.stop();
gWorkers.searchWorker.stop();
}
/** * Create and mount the root App component. * * @param {ReduxStore} store * @param {ReduxStore} toolboxStore * @param {Object} appComponentAttributes * @param {Array} appComponentAttributes.fluentBundles * @param {Document} appComponentAttributes.toolboxDoc
*/
export function bootstrapApp(store, toolboxStore, appComponentAttributes = {}) { const mount = getMountElement(); if (!mount) { return;
}
ReactDOM.render(
React.createElement(
Provider,
{ store },
React.createElement(
ToolboxProvider,
{ store: toolboxStore },
React.createElement(App, appComponentAttributes)
)
),
mount
);
}
function getMountElement() { return document.querySelector("#mount");
}
// This is the opposite of bootstrapApp
export function unmountRoot() {
ReactDOM.unmountComponentAtNode(getMountElement());
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.