screen

Methods

(static) analyzeRefreshRateAccuracy(realRefreshRate, datapoints, sampleSize) → {Object}

Analyzes the accuracy of getRefreshRate

Example
viewstat.screen.analyzeRefreshRateAccuracy(60, 7, 100).then((data) => {
    console.log(data);
}
Parameters:
Name Type Description
realRefreshRate number

Real refresh rate of the current monitor.

datapoints number

Number of time stamps to be taken for a single test run. A larger number increases accuracy.

sampleSize number

Number of test runs.

Returns:

Returns a promise and an execution time estimate.

Type
Object

(static) analyzeRefreshRateAccuracyCallback(callback, realRefreshRate, datapoints, sampleSize) → {Date}

ES5-compatible version of analyzeRefreshRateAccuracy that uses a callback function instead of an ES6 Promise.

Example
const logData = (data) => console.log(data);
viewstat.screen.analyzeRefreshRateAccuracyCallback(callback, 60, 7, 100);
Parameters:
Name Type Description
callback RefreshRateCallback

Function to call the result to.

realRefreshRate number

Real refresh rate of the current monitor.

datapoints number

Number of time stamps to be taken for a single test run. A larger number increases accuracy.

sampleSize number

Number of test runs.

Returns:

Estimated execution time.

Type
Date

(static) getRefreshRate(datapoints) → {Promise.<number>|null}

Determines the current monitor's refresh rate (in Hertz).

Example
// get the refresh rate of the current screen in Hertz
viewstat.screen.getRefreshRate().then((result) => {
    console.log(result);
});
Parameters:
Name Type Description
datapoints number
Returns:
Type
Promise.<number> | null

(static) getRefreshRateCallback(callback, datapoints) → {void}

ES5-compatible version of getRefreshRate that uses a callback function instead of an ES6 Promise.

Example
const callback = (result) => console.log(result);
viewstat.screen.getRefreshRateCallback(callback);
Parameters:
Name Type Description
callback RefreshRateCallback

Function to call the result to.

datapoints number

Number of time stamps to be taken. A larger number increases accuracy.

Returns:
Type
void

(inner) colorBitDepth() → {number}

Returns the number of bits per color.

Returns:
Type
number

(inner) colorDepth() → {number}

Returns the number of color bits per pixel.

Returns:
Type
number

(inner) colorRange() → {number}

Returns the size of the browser's color space, i.e. the number of possible colors.

Returns:
Type
number

(inner) colorSpace() → {"sRGB"|"p3"|"rec2020"}

Returns the browser's color gamut/color space.

Returns:
Type
"sRGB" | "p3" | "rec2020"

(inner) isTerminal() → {boolean}

Checks if the webpage is running in a terminal browser. Yes, those exist.

Returns:
Type
boolean

Type Definitions

RefreshRateCallback(refreshRate)

Parameters:
Name Type Description
refreshRate number

Methods

(static) analyzeRefreshRateAccuracy(realRefreshRate, datapoints, sampleSize) → {Object}

Analyzes the accuracy of getRefreshRate

Example
viewstat.screen.analyzeRefreshRateAccuracy(60, 7, 100).then((data) => {
    console.log(data);
}
Parameters:
Name Type Description
realRefreshRate number

Real refresh rate of the current monitor.

datapoints number

Number of time stamps to be taken for a single test run. A larger number increases accuracy.

sampleSize number

Number of test runs.

Returns:

Returns a promise and an execution time estimate.

Type
Object

(static) analyzeRefreshRateAccuracyCallback(callback, realRefreshRate, datapoints, sampleSize) → {Date}

ES5-compatible version of analyzeRefreshRateAccuracy that uses a callback function instead of an ES6 Promise.

Example
const logData = (data) => console.log(data);
viewstat.screen.analyzeRefreshRateAccuracyCallback(callback, 60, 7, 100);
Parameters:
Name Type Description
callback RefreshRateCallback

Function to call the result to.

realRefreshRate number

Real refresh rate of the current monitor.

datapoints number

Number of time stamps to be taken for a single test run. A larger number increases accuracy.

sampleSize number

Number of test runs.

Returns:

Estimated execution time.

Type
Date

(static) getRefreshRate(datapoints) → {Promise.<number>|null}

Determines the current monitor's refresh rate (in Hertz).

Example
// get the refresh rate of the current screen in Hertz
viewstat.screen.getRefreshRate().then((result) => {
    console.log(result);
});
Parameters:
Name Type Description
datapoints number
Returns:
Type
Promise.<number> | null

(static) getRefreshRateCallback(callback, datapoints) → {void}

ES5-compatible version of getRefreshRate that uses a callback function instead of an ES6 Promise.

Example
const callback = (result) => console.log(result);
viewstat.screen.getRefreshRateCallback(callback);
Parameters:
Name Type Description
callback RefreshRateCallback

Function to call the result to.

datapoints number

Number of time stamps to be taken. A larger number increases accuracy.

Returns:
Type
void

(inner) colorBitDepth() → {number}

Returns the number of bits per color.

Returns:
Type
number

(inner) colorDepth() → {number}

Returns the number of color bits per pixel.

Returns:
Type
number

(inner) colorRange() → {number}

Returns the size of the browser's color space, i.e. the number of possible colors.

Returns:
Type
number

(inner) colorSpace() → {"sRGB"|"p3"|"rec2020"}

Returns the browser's color gamut/color space.

Returns:
Type
"sRGB" | "p3" | "rec2020"

(inner) isTerminal() → {boolean}

Checks if the webpage is running in a terminal browser. Yes, those exist.

Returns:
Type
boolean

Type Definitions

RefreshRateCallback(refreshRate)

Parameters:
Name Type Description
refreshRate number