Skip to content

loadAndCacheImage api

Chris Hafey edited this page May 6, 2014 · 1 revision

The loadAndCacheImage api call is used to initiate a load of an image given an imageId and add it to the cache. Cornerstone first checks the cache to see if the specified imageId was previously loaded. If the imageId is not in the cache, cornerstone attempts to locate a suitable ImageLoader for the imageId and requests the image to be loaded. Since image loading is an asynchronous operation, this function returns a promise which will resolve to an image object on success. Typical workflow is to call displayImage() after a successful load. If cacheing is not desired, use the loadImage() API.

function loadAndCacheImage(imageId);

Parameters:

  • imageId - the imageId to load

Returns: A promise which resolves to an Image object once loaded