Home Reference Source
public class | source

Utils

Utils class

Static Member Summary

Static Public Members
public static

promise: *

public static

reject: *

public static

resolve: *

Static Method Summary

Static Public Methods
public static

cleanLink(url: *): *

public static

deferred(): Deferred

public static

Get current url

public static

getNormRatio(val: Number, min: Number, max: Number): Number

Gets normalized ratio of value inside range.

public static

getPort(p: *): *

Get port

public static

Get random integer.

public static

getRandomNumber(min: Number, max: Number, decimal: Number): Number

Get random number.

public static

Match CSS media queries and JavaScript window width.

public static

logCredits(siteName: String, bgColor: String, creditsList: Array, thanksList: Array, textColor: String)

Log credits to console for code lovers.

public static

Get a css property with the vendor prefix.

public static

request(url: String, worker: Worker | null): Promise

Start a fetch request

public static

Request timeout (in ms)

public static
public static

Send a GA page view event when context is AJAX.

Static Public Members

public static promise: * source

public static reject: * source

public static resolve: * source

Static Public Methods

Params:

NameTypeAttributeDescription
url *

Return:

*

public static deferred(): Deferred source

Return a new "Deferred" object https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred

Return:

Deferred

public static getCurrentUrl(): string source

Get current url

Return:

string

public static getNormRatio(val: Number, min: Number, max: Number): Number source

Gets normalized ratio of value inside range.

from https://github.com/mout/mout/blob/master/src/math/norm.js

Params:

NameTypeAttributeDescription
val Number
min Number
max Number

Return:

Number

public static getPort(p: *): * source

Get port

Params:

NameTypeAttributeDescription
p *

Return:

*

public static getRandomInt(min: Number, max: Number): Number source

Get random integer.

Params:

NameTypeAttributeDescription
min Number

[min value]

max Number

[max value]

Return:

Number

public static getRandomNumber(min: Number, max: Number, decimal: Number): Number source

Get random number.

Params:

NameTypeAttributeDescription
min Number

[min value]

max Number

[max value]

decimal Number

Return:

Number

public static getViewportSize(): Object source

Match CSS media queries and JavaScript window width.

Return:

Object

See:

public static logCredits(siteName: String, bgColor: String, creditsList: Array, thanksList: Array, textColor: String) source

Log credits to console for code lovers.

Params:

NameTypeAttributeDescription
siteName String
bgColor String
creditsList Array
thanksList Array
textColor String

(optional)

public static prefixProperty(property: String): String source

Get a css property with the vendor prefix.

Params:

NameTypeAttributeDescription
property String

the css property

Return:

String

the prefixed property

public static request(url: String, worker: Worker | null): Promise source

Start a fetch request

Params:

NameTypeAttributeDescription
url String
worker Worker | null

Return:

Promise

public static requestTimeout(): number source

Request timeout (in ms)

Return:

number

public static stripTrailingSlash(str: String): String source

Params:

NameTypeAttributeDescription
str String

Return:

String

public static trackGoogleAnalytics() source

Send a GA page view event when context is AJAX.