All files / modules link.js

25% Statements 2/8
0% Branches 0/2
0% Functions 0/2
33.33% Lines 2/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 191x                 1x                  
const userAgent = navigator.userAgent.toLowerCase();
 
/**
 * Action creator for opening links.
 *
 * @param {Object} href - The link.
 *
 * @returns {Function} The open link function.
 */
export const openLink = (href) => () => {
  if (userAgent.indexOf('electron') > -1) {
    const { shell } = require('electron');
 
    shell.openExternal(href);
  } else {
    window.open(href, '_new');
  }
};