dist/crocodoc.viewer.js
function(objectType, pageNum) {
            var url = this.getURL(pageNum),
                $promise;

            if (cache[pageNum]) {
                return cache[pageNum];
            }

            $promise = ajax.fetch(url, Crocodoc.ASSET_REQUEST_RETRIES);

            // @NOTE: promise.then() creates a new promise, which does not copy
            // custom properties, so we need to create a futher promise and add
            // an object with the abort method as the new target
            cache[pageNum] = $promise.then(processTextContent).promise({
                abort: function () {
                    $promise.abort();
                    if (cache) {
                        delete cache[pageNum];
                    }
                }
            });
            return cache[pageNum];
        }
function(objectType, pageNum) {
            var url = this.getURL(pageNum),
                $promise;

            if (cache[pageNum]) {
                return cache[pageNum];
            }

            $promise = ajax.fetch(url, Crocodoc.ASSET_REQUEST_RETRIES);

            // @NOTE: promise.then() creates a new promise, which does not copy
            // custom properties, so we need to create a futher promise and add
            // an object with the abort method as the new target
            cache[pageNum] = $promise.then(processTextContent).promise({
                abort: function () {
                    $promise.abort();
                    if (cache) {
                        delete cache[pageNum];
                    }
                }
            });
            return cache[pageNum];
        }
function ( objectType , pageNum ) { var url = this . getURL ( pageNum ) , $promise ; if ( cache [ pageNum ] ) { return cache [ pageNum ] ; } $promise = ajax . fetch ( url , Crocodoc . ASSET_REQUEST_RETRIES ) ; // @NOTE: promise.then() creates a new promise, which does not copy // custom properties, so we need to create a futher promise and add // an object with the abort method as the new target cache [ pageNum ] = $promise . then ( processTextContent ) . promise ( { abort : function ( ) { $promise . abort ( ) ; if ( cache ) { delete cache [ pageNum ] ; } } } ) ; return cache [ pageNum ] ; }
Retrieve a text asset from the server
@param {string} objectType The type of data being requested
@param {number} pageNum The page number for which to request the text HTML
@returns {$.Promise}    A promise with an additional abort() method that will abort the XHR request.
Retrieve a text asset from the server