This AI is still in early stages of development.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Check if a dependency is available, try and load it if not, return availability state...

 

Syntax

var available = Check.has(file[, ver[, lazy]])

Parameters

ParameterTypeMandatoryNotesUtil.js version
fileString(tick)Filename of dependency1.0
ver

Number

Constant

(error)

Specify the required version of the file (exact match) or a version constant:

  • Check.ANY_VERSION – skip version check
  • Check.NOT_LOADED – fail dependency check if the file is already loaded

Default: Check.ANY_VERSION

1.0
lazyConstant(error)

By default, Check.has() will attempt to autoload missing dependencies.

If you want to prevent autoloading, specify Check.LAZY_LOAD

1.0

Return Values

ValueTypeNotesUtil.js version
trueBooleanThe dependency check was successful.1.0
falseBoolean

The dependency check failed.

1.0
<error>ErrorAn error occurred, most likely invalid parameters.1.0

Example

Check specific version of file...
function bleh() {
  if (Check.has("foo.js", 1.2)) {
    // do it the foo.js v1.2 way
  } else {
    // do it without any foo
  }
}

Notes

You can get a list of all provided dependencies using Util API diagnostics (requires Diag API).

Availability BETA

Requires:

Contents

Jump to:

Dependency Checking

Topics:

 

  • No labels