source: trip-planner-front/node_modules/karma/context/main.js@ 6fe77af

Last change on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 913 bytes
Line 
1// Load in our dependencies
2var ContextKarma = require('./karma')
3
4// Resolve our parent window
5var parentWindow = window.opener || window.parent
6
7// Define a remote call method for Karma
8var callParentKarmaMethod = ContextKarma.getDirectCallParentKarmaMethod(parentWindow)
9
10// If we don't have access to the window, then use `postMessage`
11// DEV: In Electron, we don't have access to the parent window due to it being in a separate process
12// DEV: We avoid using this in Internet Explorer as they only support strings
13// https://caniuse.com/?search=postmessage
14var haveParentAccess = false
15try { haveParentAccess = !!parentWindow.window } catch (err) { /* Ignore errors (likely permisison errors) */ }
16if (!haveParentAccess) {
17 callParentKarmaMethod = ContextKarma.getPostMessageCallParentKarmaMethod(parentWindow)
18}
19
20// Define a window-scoped Karma
21window.__karma__ = new ContextKarma(callParentKarmaMethod)
Note: See TracBrowser for help on using the repository browser.