Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added fastboot service check #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions addon/components/async-image.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Ember from 'ember';
import getOwner from 'ember-getowner-polyfill';

const {
Component,
Expand All @@ -12,6 +13,11 @@ const TRANSPARENT_IMAGE = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAE
export default Component.extend({
tagName: 'img',

fastboot: Ember.computed(function() {
let owner = getOwner(this);
return owner.lookup('service:fastboot');
}),

// attributes
title: null,
alt: null,
Expand Down Expand Up @@ -86,6 +92,7 @@ export default Component.extend({
},

_loadImage: observer('src', function() {
if (this.get('fastboot.isFastBoot')) { return; }
if (this._image) {
this.teardownHandlers(this._image);
}
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@
],
"dependencies": {
"ember-cli-babel": "^5.1.5",
"ember-cli-htmlbars": "^1.0.1"
"ember-cli-htmlbars": "^1.0.1",
"ember-getowner-polyfill": "^1.0.1"
},
"ember-addon": {
"configPath": "tests/dummy/config"
}
}
}