This AI is still in early stages of development.
Check.versionOf()
- Aubergine
Owned by Aubergine
Check the version of a dependency.
Syntax
var version = Check.versionOf(file);
Parameters
Parameter | Type | Mandatory | Notes | Util.js version |
---|---|---|---|---|
file | String | Name of the file you want to get the version of. | 1.0 |
Return Values
Value | Type | Notes | Util.js version |
---|---|---|---|
Check.NOT_LOADED | Constant | The file is not yet loaded. | 1.0 |
<number> | Number | The version of the file that's been loaded. | 1.0 |
<error> | Error | An error occurred, most likely invalid parameters. | 1.0 |
Example
Run code based on file version...
var version = Check.versionOf("foo.js"); if (version === Check.NOT_LOADED) { // foo.js isn't loaded yet ... } else if (version >= 2.1) { // v2.1 or higher ... } else { // version less than 2.1 ... } // Note: // if (version === Check.NOT_LOADED) { // foo.js isn't loaded yet // is equivalent to: // if (!version) { // foo.js isn't loaded yet
Contents
Jump to:
Dependency Checking
Topics:
- Tricks for including files — Some tricks with the include() function...
- Dependency Descriptor Object — Define one or more dependencies for your script...
- Check() — Perform a soft-check to see if a dependency is available...
- Check.basePath — The base path to the folder that contains the APIs folder...
- Check.paths[] — Define one or more folder paths to enable autoloading...
- Check.doWhen() — Perform a task when dependencies become available.
- Check.has() — Check if a dependency is available, try and load it if not, return availability state...
- Check.LAZY_LOAD — Disable autoloading during a dependency check...
- Check.required() — Thrown a descriptive error if dependency check fails...
- Check.NOT_LOADED — Indicates a script is not yet loaded, or must not be loaded, depending on the Check function being used...
- Check.ANY_VERSION — Skip version checking for a dependency check...
- Check.provide() — Indicate a file is now available.
- Check.versionOf() — Check the version of a dependency.
- Self Descriptor Object — Define the filename and version of your script...