How to use the ember-responsive-image/services/responsive-image.extend function in ember-responsive-image

To help you get started, we’ve selected a few ember-responsive-image examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kaliber5 / ember-lazy-responsive-image / addon / services / responsive-image.js View on Github external
import ResponsiveImageService from 'ember-responsive-image/services/responsive-image';
import { assert } from '@ember/debug';

/**
 * Service class to provides images generated by the responsive images package
 * with additional inline support
 *
 * @class ResponsiveImageService
 * @namespace Services
 * @module responsive-image
 * @public
 */
export default ResponsiveImageService.extend({

  /**
   * returns the inline image data as base64 encoded string
   *
   * @method getInlineImage
   * @param {String} imageName The origin name of the Image
   * @returns {String} the base64 encoded string
   * @public
   */
  getInlineImage(imageName) {
    assert(`There is no inline image data for image ${imageName}`, this.getLqip(imageName).hasOwnProperty('image'));
    return this.getLqip(imageName).image;
  },

  /**
   * returns whether there's an inline image for given image name

ember-responsive-image

Automatically generate resized images at build-time, optimized for the responsive web, and using components to render them easily as <picture> elements.

MIT
Latest version published 2 years ago

Package Health Score

58 / 100
Full package analysis