Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/react-devtools-core/src/standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,14 @@ function onError({code, message}) {
}
}

function openProfiler() {
// Mocked up bridge and store to allow the DevTools to be rendered
bridge = new Bridge({listen: () => {}, send: () => {}});
store = new Store(bridge, {});

reload();
}

function initialize(socket: WebSocket) {
const listeners = [];
socket.onmessage = event => {
Expand Down Expand Up @@ -372,6 +380,7 @@ const DevtoolsUI = {
setProjectRoots,
setStatusListener,
startServer,
openProfiler,
};

export default DevtoolsUI;
19 changes: 19 additions & 0 deletions packages/react-devtools/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@
<strong>before</strong> importing React DOM.
</div>
</div>
<div class="box">
<div class="box-header">Profiler</div>
<div class="box-content">
Open the <a
id="profiler"
class="link"
href="#"
>Profiler tab</a> to inspect saved profiles.
</div>
</div>
<div id="loading-status">Starting the server…</div>
</div>
</div>
Expand Down Expand Up @@ -201,6 +211,12 @@
}
}

function openProfiler() {
window.devtools
.setContentDOMNode(document.getElementById("container"))
.openProfiler();
}

const link = $('#rn-help-link');
link.addEventListener('click', event => {
event.preventDefault();
Expand All @@ -217,6 +233,9 @@
$byIp.addEventListener('click', selectAllAndCopy);
$byIp.addEventListener('focus', selectAllAndCopy);

const $profiler = $("#profiler");
$profiler.addEventListener('click', openProfiler);

let devtools;
try {
devtools = require("react-devtools-core/standalone").default;
Expand Down