Skip to content

Instantly share code, notes, and snippets.

@seanjohnson08
Created January 29, 2019 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save seanjohnson08/8bc2efec2c0ad639f0e7c3c850a6d82a to your computer and use it in GitHub Desktop.
Save seanjohnson08/8bc2efec2c0ad639f0e7c3c850a6d82a to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
inAppAlert: Ember.computed.readOnly('inAppAlertQueue.firstObject'),
init() {
this._super(...arguments);
this.set('inAppAlertQueue', [
'hello',
'ben',
'it',
'was',
'good',
'talking',
'with',
'you'
].map(message => ({
message
})));
},
actions: {
dismissAlert() {
this.get('inAppAlertQueue').shiftObject();
}
}
});
import Ember from 'ember';
export default Ember.Component.extend({
didRender() {
setTimeout(() => Ember.tryInvoke(this, 'onDismiss'), 1000);
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{inapp-alert-manager}}
<br>
<br>
Alert Manager
{{#if inAppAlert}}
{{inapp-alert
alert=inAppAlert
onDismiss=(action "dismissAlert")}}
{{/if}}
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment