Bug 1207997 - about:debugging use factories/dom helpers instead of createElement;r=janx
Make about:debugging code less verbose:
- use component factories to avoid having to remove calls to createElement
- use React.DOM helpers
- components only module.export their class
(require('my-component.js').MyComponent -> require('my-component.js'))
MozReview-Commit-ID: CBWLgcPUkMf
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* eslint-env browser */
|
||||
/* global DebuggerClient, DebuggerServer */
|
||||
|
||||
"use strict";
|
||||
|
||||
@@ -22,8 +21,11 @@ const { BrowserLoader } = Components.utils.import(
|
||||
const { require } =
|
||||
BrowserLoader("resource://devtools/client/aboutdebugging/", window);
|
||||
|
||||
const React = require("devtools/client/shared/vendor/react");
|
||||
const { AboutDebuggingApp } = require("./components/aboutdebugging");
|
||||
const {
|
||||
createFactory,
|
||||
render,
|
||||
unmountComponentAtNode } = require("devtools/client/shared/vendor/react");
|
||||
const AboutDebuggingApp = createFactory(require("./components/aboutdebugging"));
|
||||
|
||||
var AboutDebugging = {
|
||||
init() {
|
||||
@@ -38,13 +40,13 @@ var AboutDebugging = {
|
||||
let client = this.client;
|
||||
let telemetry = new Telemetry();
|
||||
|
||||
let app = React.createElement(AboutDebuggingApp, { client, telemetry });
|
||||
React.render(app, document.querySelector("#body"));
|
||||
render(AboutDebuggingApp({ client, telemetry }),
|
||||
document.querySelector("#body"));
|
||||
});
|
||||
},
|
||||
|
||||
destroy() {
|
||||
React.unmountComponentAtNode(document.querySelector("#body"));
|
||||
unmountComponentAtNode(document.querySelector("#body"));
|
||||
|
||||
this.client.close();
|
||||
this.client = null;
|
||||
|
||||
Reference in New Issue
Block a user