* Javadoc introduced @code as a replacement of <code> and <tt> which is better aligned with other javadoc tags such as @link. Use it in the Java source code. If we switch to Kotlin, then we'll definitely use Markdown. * There are more uses of @code in the JavaScript source code than <tt> so use @code for the sake of consistency. Eventually, I'd rather we switch to Markdown because it's easier on my eyes. * Xcode is plain confused by @code and @link. The Internet says that Xcode supports the backquote character to denote the beginning and end of a string of characters which should be formatted for display as code but it doesn't work for me. <tt> is not rendered at all. So use the backquote which is rendered itself. Hopefully, if we switch to Markdown, then it'll be common between JavaScript and Objective-C source code.
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
import { ImageCache } from './';
|
|
|
|
/**
|
|
* Notifies about the successful download of an {@code Image} source. The name
|
|
* is inspired by {@code Image}. The downloaded {@code Image} source is not
|
|
* available because (1) I do not know how to get it from {@link ImageCache} and
|
|
* (2) we do not need it bellow. The function was explicitly introduced to cut
|
|
* down on unnecessary {@code ImageCache} {@code observer} instances.
|
|
*
|
|
* @private
|
|
* @returns {void}
|
|
*/
|
|
function _onLoad() {
|
|
// ImageCache requires an observer; otherwise, we do not need it because we
|
|
// merely want to initiate the download and do not care what happens with it
|
|
// afterwards.
|
|
}
|
|
|
|
/**
|
|
* Initiates the retrieval of a specific {@code Image} source (if it has not
|
|
* been initiated already). Due to limitations of {@link ImageCache}, the source
|
|
* may have at most one {@code uri}. The name is inspired by {@code Image}.
|
|
*
|
|
* @param {Object} source - The {@code Image} source with preferably exactly
|
|
* one {@code uri}.
|
|
* @public
|
|
* @returns {void}
|
|
*/
|
|
export function prefetch(source) {
|
|
ImageCache && ImageCache.get().on(source, _onLoad, /* immutable */ true);
|
|
}
|