Functiondojo.exists

<script src="../../js/dojo.js"></script>
defined in dojo/_base/_loader/bootstrap.js

useful for longer api chains where you have to test each object in the chain

Usage

function (/*String*/ name, /*Object?*/ obj) (view source)
parametertypedescription
nameStringPath to an object, in the form "A.B.C".
objObjectOptional. to use as root of path. Defaults to 'dojo.global'. Null may be passed.

Examples

Example 1

// define an object
var foo = {
    bar: { }
};

// search the global scope
dojo.exists("foo.bar"); // true
dojo.exists("foo.bar.baz"); // false

// search from a particular scope
dojo.exists("bar", foo); // true
dojo.exists("bar.baz", foo); // false