jQuery.dependRegister()
Categories: Core
jQuery.dependHandle( name, handle( depend, deferred, when ) )
Description: Register a handle to extend the dependencies controller.
-
jQuery.dependHandle( name, handle( depend, deferred, when ) )
version added: 1.0name Name of the handle to extend the dependencies controller.
handle( depend, deferred, when ) A function to handle the extended dependencies. Receives the name of the dependency, the associated deferred object as arguments and the promise object of the dependent caller.
The jQuery.dependRegister()
methow allows to extend the dependencies controller which control calls
of $.ready()
, $.provide()
or $.plugin()
.
-
Simple extension of the dependencies controller.
Code:
$.dependRegister( 'dict', function( depend, deferred ){ if( !$.dict[ depend ] ){ deferred.resolve(); } else{ $.ajax({ url: $.dependSettings.dictRoot+'/'+depend+'.json', dataType: 'json', type: 'get', asnyc: true, cache: true }) .success(function( data ){ $.dictionary( depend, data ); deferred.resolve(); }); } });