MCPcopy Index your code
hub / github.com/coder/coder / openAppInNewWindow

Function openAppInNewWindow

site/src/modules/apps/apps.ts:89–105  ·  view source on GitHub ↗
(href: string)

Source from the content-addressed store, hash-verified

87// null out `opener` (durable on the opened window); and navigate `popup`
88// to the target URL. The Coder UI keeps access to `popup`s handle
89export const openAppInNewWindow = (href: string) => {
90 const popup = window.open("about:blank", "_blank", "width=900,height=600");
91 if (!popup) {
92 toast.error("Failed to open app in new window.", {
93 description: "Popup blocked. Allow popups to open this app.",
94 });
95 return;
96 }
97 try {
98 // Setting the opener to null persists in the `popup` window over refresh
99 // and navigation. The opening window retains its connection to `popup`
100 popup.opener = null;
101 } catch {
102 // Electron can throw
103 }
104 popup.location.href = href;
105};
106
107type GetAppHrefParams = {
108 path: string;

Callers 5

TerminalLinkFunction · 0.90
onClickFunction · 0.90
apps.test.tsFile · 0.90
WorkspaceAppsFunction · 0.90
TerminalMenuItemFunction · 0.90

Calls 1

openMethod · 0.80

Tested by

no test coverage detected