aboutsummaryrefslogtreecommitdiffstats
path: root/ui/lib/icon-factory.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-06-22 04:18:32 +0800
committerDan Finlay <dan@danfinlay.com>2016-06-22 04:18:32 +0800
commita08c3bc01b11fbd0e3a243359befbe9fc909edf4 (patch)
treeb79b7324139945c429ca4b6c74715d8040fdf4e1 /ui/lib/icon-factory.js
parentf7f8f8b1c50be39db22a7b10c6c6db007fe590aa (diff)
downloadtangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.gz
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.bz2
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.lz
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.xz
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.zst
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.zip
Auto linted
Diffstat (limited to 'ui/lib/icon-factory.js')
-rw-r--r--ui/lib/icon-factory.js17
1 files changed, 8 insertions, 9 deletions
diff --git a/ui/lib/icon-factory.js b/ui/lib/icon-factory.js
index 1b1df9490..ee784dbd8 100644
--- a/ui/lib/icon-factory.js
+++ b/ui/lib/icon-factory.js
@@ -1,18 +1,18 @@
var iconFactory
-module.exports = function(jazzicon) {
+module.exports = function (jazzicon) {
if (!iconFactory) {
iconFactory = new IconFactory(jazzicon)
}
return iconFactory
}
-function IconFactory(jazzicon) {
+function IconFactory (jazzicon) {
this.jazzicon = jazzicon
this.cache = {}
}
-IconFactory.prototype.iconForAddress = function(address, diameter) {
+IconFactory.prototype.iconForAddress = function (address, diameter) {
if (this.isCached(address, diameter)) {
return this.cache[address][diameter]
}
@@ -22,30 +22,29 @@ IconFactory.prototype.iconForAddress = function(address, diameter) {
return dataUri
}
-IconFactory.prototype.generateNewUri = function(address, diameter) {
+IconFactory.prototype.generateNewUri = function (address, diameter) {
var numericRepresentation = jsNumberForAddress(address)
var identicon = this.jazzicon(diameter, numericRepresentation)
var identiconSrc = identicon.innerHTML
- var dataUri = 'data:image/svg+xml;charset=utf-8,'+encodeURIComponent(identiconSrc)
+ var dataUri = 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(identiconSrc)
return dataUri
}
-IconFactory.prototype.cacheIcon = function(address, diameter, icon) {
+IconFactory.prototype.cacheIcon = function (address, diameter, icon) {
if (!(address in this.cache)) {
var sizeCache = {}
sizeCache[diameter] = icon
return this.cache[address] = sizeCache
-
} else {
return this.cache[address][diameter] = icon
}
}
-IconFactory.prototype.isCached = function(address, diameter) {
+IconFactory.prototype.isCached = function (address, diameter) {
return address in this.cache && diameter in this.cache[address]
}
-function jsNumberForAddress(address) {
+function jsNumberForAddress (address) {
var addr = address.slice(2, 10)
var seed = parseInt(addr, 16)
return seed