Last active
October 23, 2018 15:41
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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