Skip to content

Instantly share code, notes, and snippets.

@twokul
Last active August 29, 2015 14:15
Show Gist options
  • Save twokul/cd2db81880e50db39b03 to your computer and use it in GitHub Desktop.
Save twokul/cd2db81880e50db39b03 to your computer and use it in GitHub Desktop.
lazy-loading-image-in-ember
import { get, set } from 'ember';
import InViewportMixin from '../mixins/in-viewport';
export default Component.extend(InViewportMixin, {
lazyUrl: null,
elementInViewport: observer('enteredViewport', function() {
// assuming the url was passed into the component
set(this, 'lazyUrl', get(this, 'url'));
}).on('didInsertElement')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment