logrocket-expose-session
v1.0.5
Published
Place your logrocket session id on the window, so other applications can access it. You can access it with window.logrocketSessionId
Downloads
8
Readme
logrocket-expose-session
Place your logrocket session id on the window, so other applications can access it.
Usage
LogRocket.init(config.LOGROCKET_API_KEY);
logrocketExposeSession(LogRocket);
You can access it with window.logrocketSessionId
It also supports using window.postMessage to get the session id
To request the session id, use
window.postMessage({ type: "logrocket-expose-session-get" }, "*");
and add a listener for the response
window.addEventListener(
"message",
(event) => {
// We only accept messages from ourselves
if (event.source != window) return;
if (event.data.type && event.data.type == "logrocket-expose-session") {
console.log("The LogRocket Session ID is: " + event.data.text);
}
},
false
);
This is useful in cases such as building chrome extensions.