Gaëtan Renaudeau
7 years ago
committed by
GitHub
1 changed files with 7 additions and 2 deletions
@ -1,12 +1,17 @@ |
|||||
// @flow
|
// @flow
|
||||
import { shell } from 'electron' |
|
||||
import { track } from 'analytics/segment' |
import { track } from 'analytics/segment' |
||||
|
|
||||
|
let shell |
||||
|
if (!process.env.STORYBOOK_ENV) { |
||||
|
const electron = require('electron') |
||||
|
shell = electron.shell |
||||
|
} |
||||
|
|
||||
export const openURL = ( |
export const openURL = ( |
||||
url: string, |
url: string, |
||||
customEventName: string = 'OpenURL', |
customEventName: string = 'OpenURL', |
||||
extraParams: Object = {}, |
extraParams: Object = {}, |
||||
) => { |
) => { |
||||
track(customEventName, { ...extraParams, url }) |
track(customEventName, { ...extraParams, url }) |
||||
shell.openExternal(url) |
shell && shell.openExternal(url) |
||||
} |
} |
||||
|
Loading…
Reference in new issue