diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-17 18:59:02 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-17 18:59:02 +0800 |
commit | bf8ac3b9e6ee59f267f7850418febfe84dedceb8 (patch) | |
tree | 0617e583892f9a8fe96a55dcac3a7f9af1ddae10 /packages/website/ts/local_storage | |
parent | edcdc9b1b903158cc61529853d7e9028ecbc266a (diff) | |
download | dexon-sol-tools-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar dexon-sol-tools-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.gz dexon-sol-tools-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.bz2 dexon-sol-tools-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.lz dexon-sol-tools-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.xz dexon-sol-tools-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.zst dexon-sol-tools-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.zip |
Fix tslint issues
Diffstat (limited to 'packages/website/ts/local_storage')
3 files changed, 15 insertions, 15 deletions
diff --git a/packages/website/ts/local_storage/local_storage.ts b/packages/website/ts/local_storage/local_storage.ts index 1e3258ce0..13d9ca401 100644 --- a/packages/website/ts/local_storage/local_storage.ts +++ b/packages/website/ts/local_storage/local_storage.ts @@ -5,7 +5,7 @@ export const localStorage = { return !!window.localStorage; }, getItemIfExists(key: string): string { - if (!this.doesExist) { + if (!localStorage.doesExist) { return undefined; } const item = window.localStorage.getItem(key); @@ -15,13 +15,13 @@ export const localStorage = { return item; }, setItem(key: string, value: string): void { - if (!this.doesExist || _.isUndefined(value)) { + if (!localStorage.doesExist || _.isUndefined(value)) { return; } window.localStorage.setItem(key, value); }, removeItem(key: string): void { - if (!this.doesExist) { + if (!localStorage.doesExist) { return; } window.localStorage.removeItem(key); @@ -37,7 +37,7 @@ export const localStorage = { localStorage.setItem(key, JSON.stringify(value)); }, getAllKeys(): string[] { - if (!this.doesExist) { + if (!localStorage.doesExist) { return []; } return _.keys(window.localStorage); diff --git a/packages/website/ts/local_storage/tracked_token_storage.ts b/packages/website/ts/local_storage/tracked_token_storage.ts index f865f8109..b1b579aef 100644 --- a/packages/website/ts/local_storage/tracked_token_storage.ts +++ b/packages/website/ts/local_storage/tracked_token_storage.ts @@ -17,7 +17,7 @@ export const trackedTokenStorage = { localStorage.setItem(TRACKED_TOKENS_CLEAR_KEY, configs.LAST_LOCAL_STORAGE_TRACKED_TOKEN_CLEARANCE_DATE); }, addTrackedTokenToUser(userAddress: string, networkId: number, token: Token): void { - const trackedTokensByUserAddress = this.getTrackedTokensByUserAddress(); + const trackedTokensByUserAddress = trackedTokenStorage.getTrackedTokensByUserAddress(); let trackedTokensByNetworkId = trackedTokensByUserAddress[userAddress]; if (_.isUndefined(trackedTokensByNetworkId)) { trackedTokensByNetworkId = {}; @@ -57,7 +57,7 @@ export const trackedTokenStorage = { return trackedTokensByAddress; }, removeTrackedToken(userAddress: string, networkId: number, tokenAddress: string): void { - const trackedTokensByUserAddress = this.getTrackedTokensByUserAddress(); + const trackedTokensByUserAddress = trackedTokenStorage.getTrackedTokensByUserAddress(); const trackedTokensByNetworkId = trackedTokensByUserAddress[userAddress]; const trackedTokens = trackedTokensByNetworkId[networkId]; const remainingTrackedTokens = _.filter(trackedTokens, (token: Token) => { diff --git a/packages/website/ts/local_storage/trade_history_storage.tsx b/packages/website/ts/local_storage/trade_history_storage.tsx index 2e2f4e64e..a9b042820 100644 --- a/packages/website/ts/local_storage/trade_history_storage.tsx +++ b/packages/website/ts/local_storage/trade_history_storage.tsx @@ -27,31 +27,31 @@ export const tradeHistoryStorage = { localStorage.setItem(FILL_CLEAR_KEY, configs.LAST_LOCAL_STORAGE_FILL_CLEARANCE_DATE); }, addFillToUser(userAddress: string, networkId: number, fill: Fill): void { - const fillsByHash = this.getUserFillsByHash(userAddress, networkId); - const fillHash = this._getFillHash(fill); + const fillsByHash = tradeHistoryStorage.getUserFillsByHash(userAddress, networkId); + const fillHash = tradeHistoryStorage._getFillHash(fill); const doesFillExist = !_.isUndefined(fillsByHash[fillHash]); if (doesFillExist) { return; // noop } fillsByHash[fillHash] = fill; const userFillsJSONString = JSON.stringify(fillsByHash); - const userFillsKey = this._getUserFillsKey(userAddress, networkId); + const userFillsKey = tradeHistoryStorage._getUserFillsKey(userAddress, networkId); localStorage.setItem(userFillsKey, userFillsJSONString); }, removeFillFromUser(userAddress: string, networkId: number, fill: Fill): void { - const fillsByHash = this.getUserFillsByHash(userAddress, networkId); - const fillHash = this._getFillHash(fill); + const fillsByHash = tradeHistoryStorage.getUserFillsByHash(userAddress, networkId); + const fillHash = tradeHistoryStorage._getFillHash(fill); const doesFillExist = !_.isUndefined(fillsByHash[fillHash]); if (!doesFillExist) { return; // noop } delete fillsByHash[fillHash]; const userFillsJSONString = JSON.stringify(fillsByHash); - const userFillsKey = this._getUserFillsKey(userAddress, networkId); + const userFillsKey = tradeHistoryStorage._getUserFillsKey(userAddress, networkId); localStorage.setItem(userFillsKey, userFillsJSONString); }, getUserFillsByHash(userAddress: string, networkId: number): { [fillHash: string]: Fill } { - const userFillsKey = this._getUserFillsKey(userAddress, networkId); + const userFillsKey = tradeHistoryStorage._getUserFillsKey(userAddress, networkId); const userFillsJSONString = localStorage.getItemIfExists(userFillsKey); if (_.isEmpty(userFillsJSONString)) { return {}; @@ -66,7 +66,7 @@ export const tradeHistoryStorage = { return userFillsByHash; }, getFillsLatestBlock(userAddress: string, networkId: number): number { - const userFillsLatestBlockKey = this._getFillsLatestBlockKey(userAddress, networkId); + const userFillsLatestBlockKey = tradeHistoryStorage._getFillsLatestBlockKey(userAddress, networkId); const blockNumberStr = localStorage.getItemIfExists(userFillsLatestBlockKey); if (_.isEmpty(blockNumberStr)) { return constants.GENESIS_ORDER_BLOCK_BY_NETWORK_ID[networkId]; @@ -75,7 +75,7 @@ export const tradeHistoryStorage = { return blockNumber; }, setFillsLatestBlock(userAddress: string, networkId: number, blockNumber: number): void { - const userFillsLatestBlockKey = this._getFillsLatestBlockKey(userAddress, networkId); + const userFillsLatestBlockKey = tradeHistoryStorage._getFillsLatestBlockKey(userAddress, networkId); localStorage.setItem(userFillsLatestBlockKey, `${blockNumber}`); }, _getUserFillsKey(userAddress: string, networkId: number): string { |