Utils

Contains helper functions for the developer.

Properties:
Name Type Description
BROWSER Object

Contains the type of browser that we are currently on (based on user agent).

Format:

{
  "OPERA": false,
  "IE": false,
  "CHROME": true,
  "FIREFOX": false,
  "FIREFOX_LEGACY": false,
  "EDGE_WITH_EXTENSION": false,
  "EDGE_LEGACY": false,
  "SAFARI": false,
  "SAFARI_NO_NPAPI": false
}

Methods

(static) atou(inputString) → {String}

Output unicode string from base64 string

Parameters:
Name Type Description
inputString String

base64 string input.

Example
let inputString = 'Zm9v'
AW4.Utils.atou(inputString) // returns "foo"

(static) getFullURI(relativeURL) → {String}

Returns full URL from relative URL

Parameters:
Name Type Description
relativeURL String

The relative URL that we want the full path to. It must be relative to the current page being rendered. If a full URL is provided, it will return the same.

Example
// If current rendered page is https://example.com/my/page
let relativeURL = 'foo.txt'
AW4.Utils.getFullURI(relativeURL) // returns "https://example.com/my/page/foo.txt"

(static) launchConnect(callbacks) → {null}

Attempt to launch Connect. It will handle different browser implementations to not end in an error page or launch multiple times.

Parameters:
Name Type Description
callbacks Callbacks

success and error functions to receive results.

Result returned to success callback:

  • true - If Connect is installed.
  • false - If Connect is either not installed or we could not detect it.

(static) utoa(inputString) → {String}

Output base64 string from utf8 or unicode string

Parameters:
Name Type Description
inputString String

utf8 or unicode string input.

Example
let inputString = 'foo'
AW4.Utils.atou(inputString) // returns "Zm9v"