Last active
August 11, 2016 10:19
-
-
Save chrism/2c54406c37dd890dc119a1c9cae9f315 to your computer and use it in GitHub Desktop.
Testing async behaviour - 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
tagName: 'img', | |
attributeBindings: ['src'], | |
simpleLoadImage() { | |
let img = new Image(); | |
img.src = this.get('src'); | |
img.onload = () => { | |
this.get('onImageLoad')(); | |
}; | |
}, | |
returnSwatchesOnInsert: Ember.on('didInsertElement', function() { | |
Ember.run.scheduleOnce('afterRender', this, this.simpleLoadImage); | |
}) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
imageLoaded: false, | |
actions: { | |
imageLoaded() { | |
this.set('imageLoaded', true); | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.10.4", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.7.0", | |
"ember-data": "2.7.0", | |
"ember-template-compiler": "2.7.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment