Module: background script - util

Methods

(inner) asyncArrLoop(arr, loopFunction, callbackopt, ind)

Creates an asynchronous array loop, i.e., each iteration waits for the asynchronous call of the last iteration before beginning.
Parameters:
Name Type Attributes Description
arr Array.<Object> The array we want to iterate over.
loopFunction function The function which does things with the element. Gets two params: (item, callback) where item is the array element and callback is the callback function.
callback function <optional>
Optional callback function, executed after the loop is done.
ind number Index for next element to process.
Source:

(inner) daysToMilliseconds(days)

Converts a number in days to a number in milliseconds.
Parameters:
Name Type Description
days number The number of days which should get converted to milliseconds.
Source:

(inner) getKeyFromUrl(url)

Turns an url into a key for our database. The key is simply the hostname of that url.
Parameters:
Name Type Description
url string The url of which we want to get a key.
Source:

(inner) isToday(date)

Checks if a given date object is today.
Parameters:
Name Type Description
date Date The date object to check.
Source:

(inner) removeParamsFromUrl(url)

Removes parameter from a given url such that we only have the url without parameter left.
Parameters:
Name Type Description
url string The url from which we want to remove the parameter.
Source: