Add shorcuts for windows & linux to debugger.html

Summary:
Very simple PR to add the shorcuts for windows/linux to the web debuger interface so it's less mac-centric.

**Test plan**: Open the debugger and see the shorcuts for windows/linux/mac
Closes https://github.com/facebook/react-native/pull/9812

Differential Revision: D3862570

fbshipit-source-id: 54605af66b674d176b3cbbb9efcfa93f84fcd552
This commit is contained in:
Damien 2016-09-14 02:55:14 -07:00 committed by Facebook Github Bot 4
parent f3253c0f84
commit f4e3e19f8c

View File

@ -21,7 +21,15 @@ function setStatus(status) {
document.getElementById('status').innerHTML = status;
}
var INITIAL_MESSAGE = 'Waiting, press <span class="shortcut">⌘R</span> in simulator to reload and connect.';
var isMacLike = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
var refresh_shortcut = isMacLike ? '⌘R' : 'Ctrl R';
window.onload = function() {
if (!isMacLike) {
document.getElementById('dev_tools_shortcut').innerHTML = 'Ctrl⇧J';
}
}
var INITIAL_MESSAGE = 'Waiting, press <span class="shortcut">' + refresh_shortcut + '</span> in simulator to reload and connect.';
function connectToDebuggerProxy() {
var worker;
@ -37,7 +45,7 @@ function connectToDebuggerProxy() {
};
window.onbeforeunload = function() {
return 'If you reload this page, it is going to break the debugging session. ' +
'You should press ⌘R in simulator to reload.';
'You should press' + refresh_shortcut + 'in simulator to reload.';
};
}
@ -61,7 +69,7 @@ function connectToDebuggerProxy() {
if (object.$event === 'client-disconnected') {
shutdownJSRuntime();
setStatus('Waiting, press <span class="shortcut">⌘R</span> in simulator to reload and connect.');
setStatus('Waiting, press <span class="shortcut">' + refresh_shortcut + '</span> in simulator to reload and connect.');
return;
}
@ -127,7 +135,7 @@ connectToDebuggerProxy();
<p>
React Native JS code runs inside this Chrome tab.
</p>
<p>Press <kbd class="shortcut">⌘⌥J</kbd> to open Developer Tools. Enable <a href="http://stackoverflow.com/a/17324511/232122" target="_blank">Pause On Caught Exceptions</a> for a better debugging experience.</p>
<p>Press <kbd id='dev_tools_shortcut' class="shortcut">⌘⌥J</kbd> to open Developer Tools. Enable <a href="https://stackoverflow.com/a/17324511/232122" target="_blank">Pause On Caught Exceptions</a> for a better debugging experience.</p>
<p>Status: <span id="status">Loading...</span></p>
</div>
</body>