Skip to content

Commit

Permalink
Add selectedMarker to the console APIs (#5107)
Browse files Browse the repository at this point in the history
  • Loading branch information
canova authored Sep 4, 2024
2 parents 6d19e07 + da763a3 commit 662dc4a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
17 changes: 12 additions & 5 deletions src/test/unit/__snapshots__/window-console.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ Array [
| \\\\ / | | '_ \\\\| '__/ _ \\\\| _| | |/ _ \\\\ '_|
|/ \\\\ _ / \\\\| | |_) | | | (_) | | | | | __/ |
| | | .__/|_| \\\\___/|_| |_|_|\\\\___|_|
/ - - \\\\ |_|
,- V__V -.
-= __- * - .,=-
\`\\\\_ - _/
\`-----' ",
/ - - \\\\ |_|
,- V__V -.
-= __- * - .,=-
\`\\\\_ - _/
\`-----' ",
"font-family: Menlo, monospace;",
],
Array [
Expand All @@ -26,6 +26,7 @@ Array [
%cwindow.profile%c - The currently loaded profile
%cwindow.filteredThread%c - The current filtered thread
%cwindow.filteredMarkers%c - The current filtered and processed markers
%cwindow.selectedMarker%c - The selected processed marker in the current thread
%cwindow.callTree%c - The call tree of the current filtered thread
%cwindow.getState%c - The function that returns the current Redux state.
%cwindow.selectors%c - All the selectors that are used to get data from the Redux state.
Expand Down Expand Up @@ -66,6 +67,12 @@ The CallTree class's source code is available here:
"",
"font-weight: bold;",
"",
"font-weight: bold;",
"",
"font-weight: bold;",
"",
"font-weight: bold;",
"",
"font-style: italic; text-decoration: underline;",
"",
"font-style: italic; text-decoration: underline;",
Expand Down
27 changes: 22 additions & 5 deletions src/utils/window-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ export function addDataToWindowObject(
},
});

defineProperty(target, 'selectedMarker', {
enumerable: true,
get() {
return selectorsForConsole.selectedThread.getSelectedMarker(getState());
},
});

target.experimental = {
enableEventDelayTracks() {
const areEventDelayTracksEnabled = dispatch(
Expand Down Expand Up @@ -237,11 +244,11 @@ export function logFriendlyPreamble() {
" | \\ / | | '_ \\| '__/ _ \\| _| | |/ _ \\ '_| ",
' |/ \\ _ / \\| | |_) | | | (_) | | | | | __/ | ',
' | | | .__/|_| \\___/|_| |_|_|\\___|_| ',
' / - - \\ |_| ',
' ,- V__V -. ',
' -= __- * - .,=- ',
' `\\_ - _/ ',
" `-----' ",
' / - - \\ |_| ',
' ,- V__V -. ',
' -= __- * - .,=- ',
' `\\_ - _/ ',
" `-----' ",
].join('\n'),
'font-family: Menlo, monospace;'
);
Expand All @@ -253,6 +260,7 @@ export function logFriendlyPreamble() {
%cwindow.profile%c - The currently loaded profile
%cwindow.filteredThread%c - The current filtered thread
%cwindow.filteredMarkers%c - The current filtered and processed markers
%cwindow.selectedMarker%c - The selected processed marker in the current thread
%cwindow.callTree%c - The call tree of the current filtered thread
%cwindow.getState%c - The function that returns the current Redux state.
%cwindow.selectors%c - All the selectors that are used to get data from the Redux state.
Expand Down Expand Up @@ -282,6 +290,9 @@ export function logFriendlyPreamble() {
// "window.filteredMarkers"
bold,
reset,
// "window.selectedMarker"
bold,
reset,
// "window.callTree"
bold,
reset,
Expand All @@ -306,6 +317,12 @@ export function logFriendlyPreamble() {
// "window.toggleTimelineType"
bold,
reset,
// "window.retrieveRawProfileDataFromBrowser"
bold,
reset,
// "window.saveToDisk"
bold,
reset,
// "processed-profile-format.md"
link,
reset,
Expand Down

0 comments on commit 662dc4a

Please sign in to comment.