1.0.5 • Published 3 years ago

logrocket-expose-session v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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.

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago