MCPcopy
hub / github.com/PostHog/posthog / afterMount

Function afterMount

frontend/src/toolbar/elements/heatmapLogic.ts:226–242  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

224
225 events: ({ actions, values, cache }) => ({
226 afterMount() {
227 if (values.heatmapEnabled) {
228 actions.getEvents()
229 }
230 cache.keyDownListener = (event: KeyboardEvent) => {
231 if (event.shiftKey && !values.shiftPressed) {
232 actions.setShiftPressed(true)
233 }
234 }
235 cache.keyUpListener = (event: KeyboardEvent) => {
236 if (!event.shiftKey && values.shiftPressed) {
237 actions.setShiftPressed(false)
238 }
239 }
240 window.addEventListener('keydown', cache.keyDownListener)
241 window.addEventListener('keyup', cache.keyUpListener)
242 },
243 beforeUnmount() {
244 window.removeEventListener('keydown', cache.keyDownListener)
245 window.removeEventListener('keyup', cache.keyUpListener)

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…