MCPcopy Create free account
hub / github.com/GoogleChrome/samples / onPopupClick

Function onPopupClick

window-management/script.js:84–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82 });
83}
84const onPopupClick = async e => {
85 const body = e.target.closest("body");
86 popups.forEach(popup => {
87 if (e.view === popup) {
88 return;
89 }
90 popup.document.exitFullscreen();
91 });
92 try {
93 if (e.view.document.fullscreenElement) {
94 return await e.view.document.exitFullscreen();
95 }
96 const screensInterface = await e.view.getScreenDetails();
97 let otherScreen = screensInterface.screens.filter(
98 screen => screen !== screensInterface.currentScreen
99 )[0];
100 if (!otherScreen) {
101 otherScreen = screensInterface.screens[0];
102 }
103 await body.requestFullscreen({
104 screen: otherScreen
105 });
106 } catch (err) {
107 console.error(err.name, err.message);
108 }
109};
110
111const elmerify = async () => {
112 // For now, don't run in an iframe, but pop out to a new window.

Callers

nothing calls this directly

Calls 1

errorMethod · 0.45

Tested by

no test coverage detected