| goog.Disposable | |
| goog.module.ModuleManager | goog.Disposable |
addLoadModule_(id, d)
Loads a single module for use with a given deferred.
Arguments:
|
code » | |||||||
addUserInitiatedLoadingModule_(id)
Ensures that the module with the given id is listed as a user-initiated
module that is being loaded. This method guarantees that a module will never
get listed more than once.
Arguments:
|
code » | |||||||
afterLoadModuleCode(id)
Method called just after module code is loaded
Arguments:
|
code » | |||||||
beforeLoadModuleCode(id)
Method called just before a module code is loaded.
Arguments:
|
code » | |||||||
dispatchActiveIdleChangeIfNeeded_()
Dispatches an ACTIVE or IDLE event if necessary.
|
code » | |||||||
dispatchModuleLoadFailed_(cause)
Handles when a module load failed.
Arguments:
|
code » | |||||||
disposeInternal()
No description.
|
code » | |||||||
execOnLoad(moduleId, fn, opt_handler, opt_noLoad, opt_userInitiated, opt_preferSynchronous)
⇒
Requests that a function be called once a particular module is loaded.
Client code can use this method to safely call into modules that may not yet
be loaded. For consistency, this method always calls the function
asynchronously -- even if the module is already loaded. Initiates loading of
the module if necessary, unless opt_noLoad is true.
Arguments:
Returns:
A callback wrapper that exposes an abort and execute method.
|
code » | |||||||
executeCallbacks_(type)
Call the callback functions of the specified type.
Arguments:
|
code » | |||||||
|
Gets the amount of delay to wait before sending a request for more modules.
If a certain module request fails, we backoff a little bit and try again.
Returns:
Delay, in ms.
|
code » | |||||||
|
Gets the application-specific module loader.
Returns:
An object that has a loadModules(ids, moduleInfoMap, opt_successFn, opt_errFn, opt_timeoutFn, opt_forceReload) method.
|
code » | |||||||
|
Gets the module context to use to initialize the module.
Returns:
The context.
|
code » | |||||||
|
Gets a module info object by id.
Arguments:
Returns:
The module info.
|
code » | |||||||
|
Builds a list of the ids of the not-yet-loaded modules that a particular
module transitively depends on, including itself.
|
code » | |||||||
handleLoadError_(status)
Handles a module load failure.
Arguments:
|
code » | |||||||
handleLoadTimeout_()
Handles a module load timeout.
|
code » | |||||||
|
Determines if the ModuleManager is active
Returns:
TRUE iff the ModuleManager is active (i.e., not idle).
|
code » | |||||||
|
Gets whether a module is currently loading or in the queue, waiting to be
loaded.
|
code » | |||||||
|
Determines if the ModuleManager is user active
Returns:
TRUE iff the ModuleManager is user active (i.e., not idle).
|
code » | |||||||
|
Loads a module, returning a goog.async.Deferred for keeping track of the
result.
Arguments:
Returns:
A deferred object.
|
code » | |||||||
loadModulesOrEnqueueIfNotLoadedOrLoading_(ids, opt_userInitiated)
⇒
Loads a list of modules or, if some other module is currently being loaded,
appends the ids to the queue of requested module ids. Registers callbacks a
module that is currently loading and returns a fired deferred for a module
that is already loaded.
Arguments:
Returns:
A mapping from id (String) to deferred objects that will callback or errback when the load for that id is finished.
|
code » | |||||||
loadModulesOrEnqueue_(ids)
Initiates loading of a list of modules or, if a module is currently being
loaded, appends the modules to the queue of requested module ids.
The caller should verify that the requested modules are not already loaded or
loading. #loadModulesOrEnqueueIfNotLoadedOrLoading_ is a more lenient
alternative to this method.
|
code » | |||||||
loadModules_(ids, opt_isRetry, opt_forceReload)
Loads a list of modules and any of their not-yet-loaded prerequisites.
If batch mode is enabled, the prerequisites will be loaded together with the
requested modules and all requested modules will be loaded at the same time.
The caller should verify that the requested modules are not already loaded
and that no modules are currently loading before calling this method.
|
code » | |||||||
|
Loads a list of modules, returning a goog.async.Deferred for keeping track of
the result.
Arguments:
Returns:
A mapping from id (String) to deferred objects that will callback or errback when the load for that id is finished.
|
code » | |||||||
loadNextModules_()
Loads the next modules on the queue.
|
code » | |||||||
maybeFinishBaseLoad_()
If we are still loading the base module, consider the load complete.
|
code » | |||||||
prefetchModule(id)
Prefetches a JavaScript module and its dependencies, which means that the
module will be downloaded, but not evaluated. To complete the module load,
the caller should also call load or execOnLoad after prefetching the module.
Arguments:
|
code » | |||||||
|
Preloads a module after a short delay.
Arguments:
Returns:
A deferred object.
|
code » | |||||||
|
Processes a list of module ids for loading. Checks if any of the modules are
already loaded and then gets transitive deps. Queues any necessary modules
if batch mode is not enabled. Returns the list of ids that should be loaded.
|
code » | |||||||
registerCallback(types, fn)
The function to call if the module manager is in error.
|
code » | |||||||
registerCallback_(type, fn)
Register a callback for the specified callback type.
|
code » | |||||||
registerInitializationCallback(fn, opt_handler)
Register an initialization callback for the currently loading module. This
should only be called by script that is executed during the evaluation of
a module's javascript. This is almost equivalent to calling the function
inline, but ensures that all the code from the currently loading module
has been loaded. This makes it cleaner and more robust than calling the
function inline.
If this function is called from the base module (the one that contains
the module manager code), the callback is held until #setAllModuleInfo
is called, or until #setModuleContext is called, whichever happens first.
|
code » | |||||||
registerLateInitializationCallback(fn, opt_handler)
Register a late initialization callback for the currently loading module.
Callbacks registered via this function are executed similar to
registerInitializationCallback, but they are fired after all
initialization callbacks are called.
|
code » | |||||||
registerModuleLoadCallbacks_(id, moduleInfo, userInitiated, d)
Registers the callbacks and handles logic if it is a user initiated module
load.
Arguments:
|
code » | |||||||
requeueBatchOrDispatchFailure_(cause)
Requeues batch loads that had more than one requested module
(i.e. modules that were not included as dependencies) as separate loads or
if there was only one requested module, fails that module with the received
cause.
Arguments:
|
code » | |||||||
setAllModuleInfo(infoMap)
Sets the module info for all modules. Should only be called once.
|
code » | |||||||
setAllModuleInfoString(opt_info, opt_loadingModuleIds)
Sets the module info for all modules. Should only be called once. Also
marks modules that are currently being loaded.
Arguments:
|
code » | |||||||
setBatchModeEnabled(enabled)
Sets the batch mode as enabled or disabled for the module manager.
Arguments:
|
code » | |||||||
setLoaded(id)
Records that a module was loaded. Also initiates loading the next module if
any module requests are queued. This method is called by code that is
generated and appended to each dynamic module's code at compilation time.
Arguments:
|
code » | |||||||
setLoader(loader)
Sets the application-specific module loader.
Arguments:
|
code » | |||||||
setModuleConstructor(fn)
Sets the constructor to use for the module object for the currently
loading module. The constructor should derive from {@see
goog.module.BaseModule}.
Arguments:
|
code » | |||||||
setModuleContext(context)
Sets the module context to use to initialize the module.
Arguments:
|
code » | |||||||
setModuleUris(moduleUriMap)
Sets the module uris.
Arguments:
|
code » |
addOnDisposeCallback(callback, opt_scope)
Invokes a callback function when this object is disposed. Callbacks are
invoked in the order in which they were added.
Arguments:
|
code » | |||
dispose()
⇒ undefined
Disposes of the object. If the object hasn't already been disposed of, calls
#disposeInternal. Classes that extend
goog.Disposable should
override #disposeInternal in order to delete references to COM
objects, DOM nodes, and other disposable objects. Reentrant.
Returns:
undefined
Nothing.
|
code » | |||
disposeInternal()
Deletes or nulls out any references to COM objects, DOM nodes, or other
disposable objects. Classes that extend
goog.Disposable should
override this method.
Not reentrant. To avoid calling it twice, it must only be called from the
subclass' disposeInternal method. Everywhere else the public
dispose method must be used.
For example:
mypackage.MyClass = function() {
goog.base(this);
// Constructor logic specific to MyClass.
...
};
goog.inherits(mypackage.MyClass, goog.Disposable);
mypackage.MyClass.prototype.disposeInternal = function() {
// Dispose logic specific to MyClass.
...
// Call superclass's disposeInternal at the end of the subclass's, like
// in C++, to avoid hard-to-catch issues.
goog.base(this, 'disposeInternal');
};
|
code » | |||
|
Use #isDisposed instead.
No description.
Returns:
Whether the object has been disposed of.
|
code » | |||
|
No description.
Returns:
Whether the object has been disposed of.
|
code » | |||
registerDisposable(disposable)
Associates a disposable object with this object so that they will be disposed
together.
Arguments:
|
code » |
|
Module info for the base module (the one that contains the module
manager code), which we set as the loading module so one can
register initialization callbacks in the base module.
The base module is considered loaded when #setAllModuleInfo is called or
#setModuleContext is called, whichever comes first.
|
Code » | |
|
Whether the batch mode (i.e. the loading of multiple modules with just one
request) has been enabled.
|
Code » | |
|
A map of callback types to the functions to call for the specified
callback type.
|
Code » | |
|
The number of consecutive failures that have happened upon module load
requests.
|
Code » | |
|
The module that is currently loading, or null if not loading anything.
|
Code » | |
|
Determines if the module manager was just active before the processing of
the last data.
|
Code » | |
|
Tracer that measures how long it takes to load a module.
|
Code » | |
|
A loader for the modules that implements loadModules(ids, moduleInfoMap,
opt_successFn, opt_errorFn, opt_timeoutFn, opt_forceReload) method.
|
Code » | |
|
The ids of the currently loading modules. If batch mode is disabled, then
this array will never contain more than one element at a time.
|
Code » | |
|
A logger.
|
Code » | |
|
The module context needed for module initialization.
|
Code » | |
|
A mapping from module id to ModuleInfo object.
|
Code » | |
|
The requested ids of the currently loading modules. This does not include
module dependencies that may also be loading.
|
Code » | |
|
A queue of the ids of requested but not-yet-loaded modules. The zero
position is the front of the queue. This is a 2-D array to group modules
together with other modules that should be batch loaded with them, if
batch loading is enabled.
|
Code » | |
|
The ids of the currently loading modules which have been initiated by user
actions.
|
Code » | |
|
Determines if the module manager was just user active before the processing
of the last data. The module manager is user active if any of the
user-initiated modules are loading or queued up to load.
|
Code » |
|
If monitoring the goog.Disposable instances is enabled, stores the creation
stack trace of the Disposable instance.
|
Code » | |
|
Disposables that should be disposed when this object is disposed.
|
Code » | |
|
Whether the object has been disposed of.
|
Code » | |
|
Callbacks to invoke when this object is disposed.
|
Code » |
goog.module.ModuleManager.getInstance()
No description.
|
code » |
|
A non-HTTP status code indicating a corruption in loaded module.
This should be used by a ModuleLoader as a replacement for the HTTP code
given to the error handler function to indicated that the module was
corrupted.
This will set the forceReload flag on the loadModules method when retrying
module loading.
|
Code » |
goog.module.ModuleManager.CallbackType
:
The type of callbacks that can be registered with the module manager,.
Constants:
|
Code » | ||||||
goog.module.ModuleManager.FailureType
:
The possible reasons for a module load failure callback being fired.
Constants:
|
Code » |