prepareForRendering(drawer) {
            const supportedTypes = drawer.getRequiredDataFormats();

            // If not loaded, await until ready and try again
            if (!this.loaded) {
                return this.await().then(_ => this.prepareForRendering(drawer));
            }

            let selfPromise;
            // If not in one of required types, transform
            if (!supportedTypes.includes(this.type)) {
                selfPromise = this.transformTo(supportedTypes);
            } else {
                selfPromise = this.await();
            }

            // If internal cache wanted and preloading enabled, convert now
            if (drawer.options.usePrivateCache && drawer.options.preloadCache) {
                return selfPromise.then(_ => this.prepareInternalCacheAsync(drawer));
            }
            return selfPromise;
        }
Preparation for rendering ensures the CacheRecord is in a format supported by the current
drawer. Furthermore, if internal cache is to be used by a drawer with preloading enabled,
it happens in this step.

Note: Should not be called if cache type is already among supported types.
@private
@param {OpenSeadragon.DrawerBase} drawer
@return {OpenSeadragon.Promise<*>} reference to the data,
 or null if not data yet loaded/ready (usually due to error)