Skip to content

Instantly share code, notes, and snippets.

@MattSPalmer
Last active October 23, 2018 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattSPalmer/dce09a8d43244690c39c382acb70489f to your computer and use it in GitHub Desktop.
Save MattSPalmer/dce09a8d43244690c39c382acb70489f to your computer and use it in GitHub Desktop.
Module providing a utility to update an object on `window` for observation via Chrome Live Expressions
// Use in tandem with Chrome Live Expressions to track values you're interested in.
// https://developers.google.com/web/updates/2018/08/devtools#watch)
window.showMe =
window.showMe ||
(() => {
return window.watchMe || null;
});
export const showMe = (key, value) => {
const current = window.watchMe || {};
window.watchMe = { ...current, [key]: value };
};
export const tapShowMe = (key, selector) => state => {
showMe(key, selector(state));
return state;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment