Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Internet Explorer alert
This browser is not recommended for use with smartdevicelink.com, and may not function properly. Upgrade to a different browser to guarantee support of all features.
close alert
To Top Created with Sketch. To Top
To Bottom Created with Sketch. To Bottom
JavaScript Suite Documentation

Version Class Reference

Constructors

Instance Methods

Constructors

new Version(major, minor, patch)

Initializes an instance of Version.

Instance Methods

version.fromString(version) ⇒ Version

Sets the major, minor, and patch values from a semantic version string (e.g. 1.2.3)

Kind: Instance method of Version
Returns: Version - A reference to the class instance for method chaining.

ParamTypeDescription
version String Parse this string (x.x.x) to a Version object

version.getMajor() ⇒ Number

Get the major version value.

Kind: Instance method of Version
Returns: Number - The major version number.

version.getMinor() ⇒ Number

Get the minor version value.

Kind: Instance method of Version
Returns: Number - The minor version number.

version.getPatch() ⇒ Number

Get the patch version value

Kind: Instance method of Version
Returns: Number - The patch version number.

version.isBetween(minVersion, maxVersion) ⇒ Number

Tests if this version instance is between the supplied versions.

Kind: Instance method of Version
Returns: Number - Returns -1 if this number is not between minVersion and maxVersion or if minVersion is greater than maxVersion. 0 if the number is equal to either minVersion or maxVersion. 1 if the number is between the minVersion and maxVersion

ParamTypeDescription
minVersion Version the lowest version to be used in the comparison
maxVersion Version the highest version to be used in the comparison

version.isNewerThan(version) ⇒ Number

Method to test if this instance of Version is newer than the supplied one.

Kind: Instance method of Version
Returns: Number - 1 if this instance is newer, -1 if supplied version is newer, and 0 if they are equal

ParamTypeDescription
version Version the version to check against

version.setMajor(major) ⇒ Version

Set the major version value.

Kind: Instance method of Version
Returns: Version - A reference to the class instance for method chaining.

ParamTypeDescription
major Number An integer for the major version value.

version.setMinor(minor) ⇒ Version

Set the minor version value.

Kind: Instance method of Version
Returns: Version - A reference to the class instance for method chaining.

ParamTypeDescription
minor Number An integer for the minor version value.

version.setPatch(patch) ⇒ Version

Set the patch version value.

Kind: Instance method of Version
Returns: Version - A reference to the class instance for method chaining.

ParamTypeDescription
patch Number An integer for the patch version value.

version.toString() ⇒ String

Get a semantic version string using the instance's major, minor, and patch version values.

Kind: Instance method of Version
Returns: String - A semantic version string.

View on GitHub.com