ON_SESSION_CLOSED etkinliği (uygulama profili yöneticisi)

Bu olay, bir oturum kapatıldığında istemci tarafından çağrılır. Bu olay, oturumun kapanmasına yanıt olarak temizleme görevlerini gerçekleştirme veya uygulama durumunu güncelleştirme fırsatı sağlar. ON_SESSION_CLOSED olay aşağıdaki eventData'yı alır:

olay verileri Description
oturum Kimliği Kapatılan oturumun oturum kimliği.

Example


// Define a handler function that's triggered when a session is closed
let sessionClosedHandlerFunction = function(eventInput) {
    // Log the ID of the closed session to the console
    console.log("Session closed: " + eventInput.data.sessionId);
};
// Retrieve the event topic specific to session closing from the API
let sessionCloseTopic = Microsoft.Apm.getEventPublisherTopic("ON_SESSION_CLOSED");
// Create a new broadcast channel to subscribe to session close events
let sessionCloseSubscriber = new BroadcastChannel(sessionCloseTopic);
// Attach the session closed handler function to the message event of the subscriber
sessionCloseSubscriber.onmessage = sessionClosedHandlerFunction;

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.