Improved docs

This commit is contained in:
Ian Gilman 2014-11-05 14:48:37 -08:00
parent 8641279890
commit e52e2fef34
3 changed files with 21 additions and 24 deletions

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2009 CodePlex Foundation * Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors * Copyright (C) 2010-2013 OpenSeadragon contributors
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
* met: * met:
@ -34,23 +34,14 @@
(function( $ ){ (function( $ ){
/** // private class
* @private
* @class ImageJob
* @classdesc Handles loading a single image for use in a single {@link OpenSeadragon.Tile}.
*
* @memberof OpenSeadragon
* @param {String} source - URL of image to download.
* @param {String} crossOriginPolicy - CORS policy to use for downloads
* @param {Function} callback - Called once image has finished downloading.
*/
function ImageJob ( options ) { function ImageJob ( options ) {
$.extend( true, this, { $.extend( true, this, {
timeout: $.DEFAULT_SETTINGS.timeout, timeout: $.DEFAULT_SETTINGS.timeout,
jobId: null jobId: null
}, options ); }, options );
/** /**
* Image object which will contain downloaded image. * Image object which will contain downloaded image.
* @member {Image} image * @member {Image} image
@ -60,11 +51,6 @@ function ImageJob ( options ) {
} }
ImageJob.prototype = { ImageJob.prototype = {
/**
* Initiates downloading of associated image.
* @method
*/
start: function(){ start: function(){
var _this = this; var _this = this;
@ -104,11 +90,13 @@ ImageJob.prototype = {
}; };
/** /**
* @class * @class ImageLoader
* @memberof OpenSeadragon
* @classdesc Handles downloading of a set of images using asynchronous queue pattern. * @classdesc Handles downloading of a set of images using asynchronous queue pattern.
* You generally won't have to interact with the ImageLoader directly.
*/ */
$.ImageLoader = function() { $.ImageLoader = function() {
$.extend( true, this, { $.extend( true, this, {
jobLimit: $.DEFAULT_SETTINGS.imageLoaderLimit, jobLimit: $.DEFAULT_SETTINGS.imageLoaderLimit,
jobQueue: [], jobQueue: [],
@ -117,8 +105,8 @@ $.ImageLoader = function() {
}; };
$.ImageLoader.prototype = { $.ImageLoader.prototype = /** @lends OpenSeadragon.ImageLoader.prototype */{
/** /**
* Add an unloaded image to the loader queue. * Add an unloaded image to the loader queue.
* @method * @method

View File

@ -34,7 +34,7 @@
(function( $ ){ (function( $ ){
// private // private class
var TileRecord = function( options ) { var TileRecord = function( options ) {
$.console.assert( options, "[TileCache.cacheTile] options is required" ); $.console.assert( options, "[TileCache.cacheTile] options is required" );
$.console.assert( options.tile, "[TileCache.cacheTile] options.tile is required" ); $.console.assert( options.tile, "[TileCache.cacheTile] options.tile is required" );
@ -43,7 +43,7 @@ var TileRecord = function( options ) {
this.tiledImage = options.tiledImage; this.tiledImage = options.tiledImage;
}; };
// private // private class
var ImageRecord = function(options) { var ImageRecord = function(options) {
$.console.assert( options, "[ImageRecord] options is required" ); $.console.assert( options, "[ImageRecord] options is required" );
$.console.assert( options.image, "[ImageRecord] options.image is required" ); $.console.assert( options.image, "[ImageRecord] options.image is required" );
@ -71,6 +71,7 @@ ImageRecord.prototype = {
}, },
addTile: function(tile) { addTile: function(tile) {
$.console.assert(tile, '[ImageRecord.addTile] tile is required');
this._tiles.push(tile); this._tiles.push(tile);
}, },
@ -94,6 +95,7 @@ ImageRecord.prototype = {
* @class TileCache * @class TileCache
* @memberof OpenSeadragon * @memberof OpenSeadragon
* @classdesc Stores all the tiles displayed in a {@link OpenSeadragon.Viewer}. * @classdesc Stores all the tiles displayed in a {@link OpenSeadragon.Viewer}.
* You generally won't have to interact with the TileCache directly.
* @param {Object} options - Configuration for this TileCache. * @param {Object} options - Configuration for this TileCache.
* @param {Number} [options.maxImageCacheCount] - See maxImageCacheCount in * @param {Number} [options.maxImageCacheCount] - See maxImageCacheCount in
* {@link OpenSeadragon.Options} for details. * {@link OpenSeadragon.Options} for details.
@ -196,8 +198,10 @@ $.TileCache.prototype = /** @lends OpenSeadragon.TileCache.prototype */{
/** /**
* Clears all tiles associated with the specified tiledImage. * Clears all tiles associated with the specified tiledImage.
* @param {OpenSeadragon.TiledImage} tiledImage
*/ */
clearTilesFor: function( tiledImage ) { clearTilesFor: function( tiledImage ) {
$.console.assert(tiledImage, '[TileCache.clearTilesFor] tiledImage is required');
var tileRecord; var tileRecord;
for ( var i = 0; i < this._tilesLoaded.length; ++i ) { for ( var i = 0; i < this._tilesLoaded.length; ++i ) {
tileRecord = this._tilesLoaded[ i ]; tileRecord = this._tilesLoaded[ i ];
@ -209,12 +213,15 @@ $.TileCache.prototype = /** @lends OpenSeadragon.TileCache.prototype */{
} }
}, },
// private
getImageRecord: function(url) { getImageRecord: function(url) {
$.console.assert(url, '[TileCache.getImageRecord] url is required');
return this._imagesLoaded[url]; return this._imagesLoaded[url];
}, },
// private // private
_unloadTile: function(tile) { _unloadTile: function(tile) {
$.console.assert(tile, '[TileCache._unloadTile] tile is required');
tile.unload(); tile.unload();
tile.cacheImageRecord = null; tile.cacheImageRecord = null;

View File

@ -35,6 +35,8 @@
(function( $ ){ (function( $ ){
/** /**
* You shouldn't have to create a TiledImage directly; use {@link OpenSeadragon.Viewer#open}
* or {@link OpenSeadragon.Viewer#addTiledImage} instead.
* @class TiledImage * @class TiledImage
* @memberof OpenSeadragon * @memberof OpenSeadragon
* @classdesc Handles rendering of tiles for an {@link OpenSeadragon.Viewer}. * @classdesc Handles rendering of tiles for an {@link OpenSeadragon.Viewer}.