Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt |
---|
Returns true if a dependency is available, otherwise false. |
Syntax
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
if (uHas(file, ver)) { // do something that needs that file } else { // do it a different way } |
Parameters
Parameter | Type | Mandatory | Notes | Util.js version |
---|---|---|---|---|
file | String | Filename of dependency | 0.8 | |
ver | Number | Minimum version of that file | 0.8 |
Return Values
Value | Type | Notes | Util.js version |
---|---|---|---|
true | Boolean | Indicates the file (and optionally version) are available. | 0.8 |
false | Boolean | Either:
| 0.8 |
<error> | Error | Something unexpected happened, most likely invalid parameters. | 0.8 |
<object> | Object | Object with named properties (file names) and numeric values (versions) of all provided libraries. See "Notes" below for more information. |
Example
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
function bleh() { if (uHas("foo.js",0.3)) { // do it the foo.js v0.3 or higher way } else if (uHas("foo.js")) { // do it the foo.js v0.2 or earlier way } else { // do it without using foo.js } } |
Notes
You can get a list of all provided dependencies using Diag API Diagnostics or by calling uHas()
without any parameters.
Div | ||
---|---|---|
| ||
AvailabilityRequires:
|
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
See AlsoRelated functionsdocumentation:
|