नोट
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप साइन इन करने या निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
यह ईवेंट क्लाइंट द्वारा तब लागू किया जाता है जब एक टैब को दूसरे टैब पर स्विच किया जाता है। यह ईवेंट क्लाइंट-साइड हैंडलर को टैब स्विच पर प्रतिक्रिया करने की अनुमति देता है, आवश्यकतानुसार उपयोगकर्ता इंटरफ़ेस या आंतरिक स्थिति को अपडेट करता है। ON_TAB_SWITCH इवेंट निम्न eventData लेता है।
| इवेंटडेटा | विवरण |
|---|---|
| पूर्वSessionId | पिछले टैब की सत्र आईडी. |
| पूर्वTabId | पिछले टैब की टैब आईडी. |
| सत्र आईडी | उस टैब की सत्र आईडी जो अब केंद्रित है. |
| टैब आईडी | उस टैब की आईडी जो अब केंद्रित है. |
उदाहरण
// Define a handler function that's triggered when the tab is switched
let tabSwitchedHandlerFunction = function(eventInput) {
// Log the previous and new session IDs and tabs IDs to the console
console.log("Previous session: " + eventInput.data.previousSessionId +
" Previous tab: " + eventInput.data.previousTabId +
" Current session: " + eventInput.data.sessionId +
" Previous tab: " + eventInput.data.tabId );
};
// Retrieve the event topic specific to tab switching from the API
let tabSwitchTopic = Microsoft.Apm.getEventPublisherTopic("ON_TAB_SWITCH");
// Create a new broadcast channel to subscribe to tab switch events
let tabSwitchSubscriber = new BroadcastChannel(tabSwitchTopic);
// Attach the tab switched handler function to the message event of the subscriber
tabSwitchSubscriber.onmessage = tabSwitchedHandlerFunction;
नोट
कोड नमूना प्रसारण चैनल API - वेब API का उपयोग विभिन्न दस्तावेज़ों जैसे पृष्ठों या iframes के बीच संचार करने के लिए करता है जो एक ही मूल के हैं। सुनिश्चित करें कि यह आपके अनुकूलन के साथ संगत है क्योंकि इस एपीआई के लिए समर्थन भिन्न हो सकता है।