Skip to content

Commit 2634e65

Browse files
committed
Add option to force isStandalone check
1 parent 8b4b25d commit 2634e65

File tree

1 file changed

+13
-2
lines changed
  • packages/codesandbox-api/src/dispatcher

1 file changed

+13
-2
lines changed

packages/codesandbox-api/src/dispatcher/index.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,20 @@
33

44
const bundlers: Map<Window, string> = new Map();
55

6+
function checkIsStandalone() {
7+
if (typeof window === 'undefined') {
8+
return true;
9+
}
10+
11+
if (window.location && window.location.href.indexOf('?standalone') > -1) {
12+
return true;
13+
}
14+
15+
return !window.opener && window.parent === window;
16+
}
17+
618
// Whether the tab has a connection with the editor
7-
export const isStandalone =
8-
typeof window === 'undefined' || (!window.opener && window.parent === window);
19+
export const isStandalone = checkIsStandalone();
920

1021
let parentOrigin: string | null = null;
1122

0 commit comments

Comments
 (0)