ON_SESSION_SWITCH etkinliği (uygulama profili yöneticisi)

Bu olay, bir oturum başka bir oturuma geçirildiğinde istemci tarafından çağrılır. Bu olay, istemci tarafı işleyicilerinin oturum anahtarlarına tepki vermesine, kullanıcı arabirimini veya iç durumu gerektiği gibi güncellemesine olanak tanır. ON_SESSION_SWITCH olay aşağıdaki eventData'yı alır:

olay verileri Description
öncekiSessionId Önceki oturumun oturum kimliği.
newSessionId Artık odaklanılan oturumun kimliği.

Example


// Define a handler function that's triggered when the session is switched
let sessionSwitchedHandlerFunction = function(eventInput) {
    // Log the previous and new session IDs to the console
    console.log("Previous session:  " + eventInput.data.previousSessionId +
                " - Current session: " + eventInput.data.newSessionId);

}; 
// Retrieve the event topic specific to session switching from the API
let sessionSwitchTopic = Microsoft.Apm.getEventPublisherTopic("ON_SESSION_SWITCH");
// Create a new broadcast channel to subscribe to session switch events
let sessionSwitchSubscriber = new BroadcastChannel(sessionSwitchTopic);
// Attach the session switched handler function to the message event of the subscriber
sessionSwitchSubscriber.onmessage = sessionSwitchedHandlerFunction;

Uyarı

Kod örneği, aynı kaynağa sahip sayfalar veya iframe'ler gibi farklı belgeler arasında iletişim kurmak için Yayın Kanalı API'si - Web API'lerini kullanır. Bu API desteği değişebileceğinden, özelleştirmenizle uyumlu olduğundan emin olun.