Perform a soft-check to see if a dependency is available...
Syntax
var available = Check(file, ver);
Parameters
Parameter
Type
Mandatory
Notes
API Version
file
String
Array of String
The name of the file to check, or an array of file names.
File name should not include path - it should just be the name and extension of the file, for example: "foo.js"
If an array is passed in, all files will be checked for the same ver (if specified).
1.0
ver
Number
Constant
The version of the dependency, or one of the following constants:
Check.ANY_VERSION – ignore version check
Check.NOT_LOADED – fail check if file(s) already loaded
Default: Check.ANY_VERSION
1.0
Return values
Value
Type
Notes
API Version
true
Boolean
The specified requirements were met
1.0
false
Boolean
One or more of the specified requirements was not met
1.0
Notes
This function is similar to Check.has() with some notable differences:
Check() allows an array of filenames in the first parameter, Check.has() does not
Check() does not attempt to autoload missing files, Check.has() does (unless told not to)
Example
if (Check("foo.js")) {
// do stuff that relies on foo.js (any version)
}
if (Check(["bar.js", "baz.js"], 1.2)) {
// do stuff that requires v1.2 of bar.js and v1.2 of baz.js
}
if (Check("foo.js", Check.NOT_LOADED)) {
// do stuff that relies on foo.js being unavailable
}