Last active
November 22, 2016 19:17
-
-
Save k-fish/cffa6f9efd5214e248a5c2a8fb6b0512 to your computer and use it in GitHub Desktop.
Runloop Async Issues
This file contains 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({ | |
green() { | |
this.$().css('background-color', 'green'); | |
}, | |
red() { | |
this.$().css('background-color', 'red'); | |
}, | |
didInsertElement() { | |
this._super(...arguments); | |
// Iffy runloop code | |
Ember.run.later(this, this.green, 2); | |
Ember.run.next(this, this.red); | |
// End runloop code | |
//this.attrs.hasInserted(); | |
}, | |
willDestroyElement() { | |
this.attrs.willDestroy(); | |
} | |
}); |
This file contains 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({ | |
appName: 'Ember Twiddle', | |
show: true, | |
actions: { | |
hasInserted() { | |
Ember.run.later(this, function() { | |
this.set('show', false); | |
}, 100); | |
}, | |
willDestroy() { | |
Ember.run.later(this, function() { | |
this.set('show', true); | |
}, 20); | |
} | |
} | |
}); |
This file contains 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.6", | |
"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.9.0", | |
"ember-data": "2.9.0", | |
"ember-template-compiler": "2.9.0", | |
"ember-testing": "2.9.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment