aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/utils/utils.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-06-27 17:02:40 +0800
committerGitHub <noreply@github.com>2018-06-27 17:02:40 +0800
commitf9fab216e9874a2457e614e55209705dd7828386 (patch)
tree5d9c16c1a51513a7da60cb6a4278845511144228 /packages/website/ts/utils/utils.ts
parente59c57106cd15d45efb6f4100529cf6e5dfe71a8 (diff)
parent84bd54ba4025a33f4e311ec66d81d58b45e54d6b (diff)
downloaddexon-sol-tools-f9fab216e9874a2457e614e55209705dd7828386.tar
dexon-sol-tools-f9fab216e9874a2457e614e55209705dd7828386.tar.gz
dexon-sol-tools-f9fab216e9874a2457e614e55209705dd7828386.tar.bz2
dexon-sol-tools-f9fab216e9874a2457e614e55209705dd7828386.tar.lz
dexon-sol-tools-f9fab216e9874a2457e614e55209705dd7828386.tar.xz
dexon-sol-tools-f9fab216e9874a2457e614e55209705dd7828386.tar.zst
dexon-sol-tools-f9fab216e9874a2457e614e55209705dd7828386.zip
Merge branch 'v2-prototype' into invalid-argument-error
Diffstat (limited to 'packages/website/ts/utils/utils.ts')
-rw-r--r--packages/website/ts/utils/utils.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts
index 0bd3dbcfa..ff06d923d 100644
--- a/packages/website/ts/utils/utils.ts
+++ b/packages/website/ts/utils/utils.ts
@@ -4,11 +4,13 @@ import { constants as sharedConstants, Networks } from '@0xproject/react-shared'
import { ECSignature, Provider } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as bowser from 'bowser';
import deepEqual = require('deep-equal');
import * as _ from 'lodash';
import * as moment from 'moment';
import {
BlockchainCallErrs,
+ BrowserType,
Environments,
Order,
Providers,
@@ -362,4 +364,21 @@ export const utils = {
const formattedAmount = unitAmount.toFixed(precision);
return `${formattedAmount} ${symbol}`;
},
+ openUrl(url: string): void {
+ window.open(url, '_blank');
+ },
+ isMobile(screenWidth: ScreenWidths): boolean {
+ return screenWidth === ScreenWidths.Sm;
+ },
+ getBrowserType(): BrowserType {
+ if (bowser.chrome) {
+ return BrowserType.Chrome;
+ } else if (bowser.firefox) {
+ return BrowserType.Firefox;
+ } else if (bowser.opera) {
+ return BrowserType.Opera;
+ } else {
+ return BrowserType.Other;
+ }
+ },
};