aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorbitpshr <mail@bitpshr.net>2018-04-20 03:12:04 +0800
committerbitpshr <mail@bitpshr.net>2018-04-20 03:14:00 +0800
commit8636f3bae547ace7d099a3ed516bf013dfe3858e (patch)
tree179fd228bbf833709d70ed68b54cbb33c089ebda /app
parent9c7eafc86f1d9d06dd6a5b66ecd2154b09299d03 (diff)
downloadtangerine-wallet-browser-8636f3bae547ace7d099a3ed516bf013dfe3858e.tar
tangerine-wallet-browser-8636f3bae547ace7d099a3ed516bf013dfe3858e.tar.gz
tangerine-wallet-browser-8636f3bae547ace7d099a3ed516bf013dfe3858e.tar.bz2
tangerine-wallet-browser-8636f3bae547ace7d099a3ed516bf013dfe3858e.tar.lz
tangerine-wallet-browser-8636f3bae547ace7d099a3ed516bf013dfe3858e.tar.xz
tangerine-wallet-browser-8636f3bae547ace7d099a3ed516bf013dfe3858e.tar.zst
tangerine-wallet-browser-8636f3bae547ace7d099a3ed516bf013dfe3858e.zip
Clean up JSDoc for background scripts
Diffstat (limited to 'app')
-rw-r--r--app/scripts/config.js4
-rw-r--r--app/scripts/contentscript.js10
-rw-r--r--app/scripts/controllers/computed-balances.js12
-rw-r--r--app/scripts/edge-encryptor.js16
-rw-r--r--app/scripts/lib/port-stream.js4
-rw-r--r--app/scripts/lib/setupMetamaskMeshMetrics.js2
-rw-r--r--app/scripts/popup-core.js8
7 files changed, 32 insertions, 24 deletions
diff --git a/app/scripts/config.js b/app/scripts/config.js
index 21905d5b4..e6f70ca2b 100644
--- a/app/scripts/config.js
+++ b/app/scripts/config.js
@@ -34,8 +34,8 @@ global.METAMASK_DEBUG = process.env.METAMASK_DEBUG
/**
* @typedef {Object} EnumConfig
* @property {string} DEFAULT_RPC Default network provider URL
- * @property {string} OLD_UI_NETWORK_TYPE
- * @property {string} BETA_UI_NETWORK_TYPE
+ * @property {string} OLD_UI_NETWORK_TYPE Network associated with old UI
+ * @property {string} BETA_UI_NETWORK_TYPE Network associated with new UI
*/
/**
diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js
index 728aab8cb..dbf1c6d4c 100644
--- a/app/scripts/contentscript.js
+++ b/app/scripts/contentscript.js
@@ -112,7 +112,7 @@ function logStreamDisconnectWarning (remoteLabel, err) {
/**
* Determines if Web3 should be injected
*
- * @returns {boolean} True of Web3 should be injected
+ * @returns {boolean} {@code true} if Web3 should be injected
*/
function shouldInjectWeb3 () {
return doctypeCheck() && suffixCheck()
@@ -122,7 +122,7 @@ function shouldInjectWeb3 () {
/**
* Checks the doctype of the current document if it exists
*
- * @returns {boolean} True if the doctype is html or if none exists
+ * @returns {boolean} {@code true} if the doctype is html or if none exists
*/
function doctypeCheck () {
const doctype = window.document.doctype
@@ -136,7 +136,7 @@ function doctypeCheck () {
/**
* Checks the current document extension
*
- * @returns {boolean} True if the current extension is not prohibited
+ * @returns {boolean} {@code true} if the current extension is not prohibited
*/
function suffixCheck () {
var prohibitedTypes = ['xml', 'pdf']
@@ -154,7 +154,7 @@ function suffixCheck () {
/**
* Checks the documentElement of the current document
*
- * @returns {boolean} True if the documentElement is an html node or if none exists
+ * @returns {boolean} {@code true} if the documentElement is an html node or if none exists
*/
function documentElementCheck () {
var documentElement = document.documentElement.nodeName
@@ -167,7 +167,7 @@ function documentElementCheck () {
/**
* Checks if the current domain is blacklisted
*
- * @returns {boolean} True if the current domain is blacklisted
+ * @returns {boolean} {@code true} if the current domain is blacklisted
*/
function blacklistedDomainCheck () {
var blacklistedDomains = [
diff --git a/app/scripts/controllers/computed-balances.js b/app/scripts/controllers/computed-balances.js
index cf2e05333..1a6802f9a 100644
--- a/app/scripts/controllers/computed-balances.js
+++ b/app/scripts/controllers/computed-balances.js
@@ -3,6 +3,14 @@ const extend = require('xtend')
const BalanceController = require('./balance')
/**
+ * @typedef {Object} ComputedBalancesOptions
+ * @property {Object} accountTracker Account tracker store reference
+ * @property {Object} txController Token controller reference
+ * @property {Object} blockTracker Block tracker reference
+ * @property {Object} initState Initial state to populate this internal store with
+ */
+
+/**
* Background controller responsible for syncing
* and computing ETH balances for all accounts
*/
@@ -10,7 +18,7 @@ class ComputedbalancesController {
/**
* Creates a new controller instance
*
- * @param {Object} [opts] Controller configuration parameters
+ * @param {ComputedBalancesOptions} [opts] Controller configuration parameters
*/
constructor (opts = {}) {
const { accountTracker, txController, blockTracker } = opts
@@ -52,7 +60,7 @@ class ComputedbalancesController {
* Uses current account state to sync and track all
* addresses associated with the current account
*
- * @param {Object} store Account tracking state
+ * @param {{ accounts: Object }} store Account tracking state
*/
syncAllAccountsFromStore (store) {
const upstream = Object.keys(store.accounts)
diff --git a/app/scripts/edge-encryptor.js b/app/scripts/edge-encryptor.js
index d2e985790..dcb06873b 100644
--- a/app/scripts/edge-encryptor.js
+++ b/app/scripts/edge-encryptor.js
@@ -7,11 +7,11 @@ const Unibabel = require('browserify-unibabel')
*/
class EdgeEncryptor {
/**
- * Encrypts an arbitrary JavaScript object to ciphertext
+ * Encrypts an arbitrary object to ciphertext
*
* @param {string} password Used to generate a key to encrypt the data
* @param {Object} dataObject Data to encrypt
- * @returns {Promise<Object>} Promise resolving to an object with ciphertext
+ * @returns {Promise<string>} Promise resolving to an object with ciphertext
*/
encrypt (password, dataObject) {
var salt = this._generateSalt()
@@ -34,11 +34,11 @@ class EdgeEncryptor {
}
/**
- * Decrypts an arbitrary JavaScript object from ciphertext
+ * Decrypts an arbitrary object from ciphertext
*
* @param {string} password Used to generate a key to decrypt the data
- * @param {string} text Ciphertext of an encrypted JavaScript object
- * @returns {Promise<Object>} Promise resolving to copy of decrypted JavaScript object
+ * @param {string} text Ciphertext of an encrypted object
+ * @returns {Promise<Object>} Promise resolving to copy of decrypted object
*/
decrypt (password, text) {
const payload = JSON.parse(text)
@@ -67,7 +67,7 @@ class EdgeEncryptor {
*
* @private
* @param {string} password Password used to unlock a cryptographic key
- * @param {string} salt Random base-64 data
+ * @param {string} salt Random base64 data
* @returns {Promise<Object>} Promise resolving to a derived key
*/
_keyFromPassword (password, salt) {
@@ -81,10 +81,10 @@ class EdgeEncryptor {
}
/**
- * Generates random base-64 encoded data
+ * Generates random base64 encoded data
*
* @private
- * @returns {string} Randomized base-64 encoded data
+ * @returns {string} Randomized base64 encoded data
*/
_generateSalt (byteCount = 32) {
var view = new Uint8Array(byteCount)
diff --git a/app/scripts/lib/port-stream.js b/app/scripts/lib/port-stream.js
index 260530e63..5c4224fd9 100644
--- a/app/scripts/lib/port-stream.js
+++ b/app/scripts/lib/port-stream.js
@@ -8,7 +8,7 @@ inherits(PortDuplexStream, Duplex)
/**
* Creates a stream that's both readable and writable.
- * The stream supports arbitrary JavaScript objects.
+ * The stream supports arbitrary objects.
*
* @class
* @param {Object} port Remote Port object
@@ -60,7 +60,7 @@ PortDuplexStream.prototype._read = noop
* this writable stream.
*
* @private
- * @param {*} msg Arbitrary JavaScript object to write
+ * @param {*} msg Arbitrary object to write
* @param {string} encoding Encoding to use when writing payload
* @param {Function} cb Called when writing is complete or an error occurs
*/
diff --git a/app/scripts/lib/setupMetamaskMeshMetrics.js b/app/scripts/lib/setupMetamaskMeshMetrics.js
index 79b9cb249..02690a948 100644
--- a/app/scripts/lib/setupMetamaskMeshMetrics.js
+++ b/app/scripts/lib/setupMetamaskMeshMetrics.js
@@ -2,7 +2,7 @@
module.exports = setupMetamaskMeshMetrics
/**
- * Injects an iframe into the curerent document for testing
+ * Injects an iframe into the current document for testing
*/
function setupMetamaskMeshMetrics() {
const testingContainer = document.createElement('iframe')
diff --git a/app/scripts/popup-core.js b/app/scripts/popup-core.js
index 69fbcf49c..6325b8a8d 100644
--- a/app/scripts/popup-core.js
+++ b/app/scripts/popup-core.js
@@ -13,7 +13,7 @@ module.exports = initializePopup
* Asynchronously initializes the MetaMask popup UI
*
* @param {{ container: Element, connectionStream: * }} config Popup configuration object
- * @param {Function} cb Called when initialization is comlete
+ * @param {Function} cb Called when initialization is complete
*/
function initializePopup ({ container, connectionStream }, cb) {
// setup app
@@ -26,7 +26,7 @@ function initializePopup ({ container, connectionStream }, cb) {
/**
* Establishes streamed connections to background scripts and a Web3 provider
*
- * @param {*} connectionStream PortStream instance establishing a background connection
+ * @param {PortDuplexStream} connectionStream PortStream instance establishing a background connection
* @param {Function} cb Called when controller connection is established
*/
function connectToAccountManager (connectionStream, cb) {
@@ -41,7 +41,7 @@ function connectToAccountManager (connectionStream, cb) {
/**
* Establishes a streamed connection to a Web3 provider
*
- * @param {*} connectionStream PortStream instance establishing a background connection
+ * @param {PortDuplexStream} connectionStream PortStream instance establishing a background connection
*/
function setupWeb3Connection (connectionStream) {
var providerStream = new StreamProvider()
@@ -56,7 +56,7 @@ function setupWeb3Connection (connectionStream) {
/**
* Establishes a streamed connection to the background account manager
*
- * @param {*} connectionStream PortStream instance establishing a background connection
+ * @param {PortDuplexStream} connectionStream PortStream instance establishing a background connection
* @param {Function} cb Called when the remote account manager connection is established
*/
function setupControllerConnection (connectionStream, cb) {