Created
May 16, 2017 10:40
-
-
Save LevelbossMike/c4b15d8ce3cc48948c49f97164756b4c to your computer and use it in GitHub Desktop.
New Twiddle
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'; | |
| import { task, timeout } from 'ember-concurrency'; | |
| export default Ember.Component.extend({ | |
| didReceiveAttrs() { | |
| this._super(...arguments); | |
| let task = this.get('message.task'); | |
| this.get('closeTask').perform(task); | |
| }, | |
| closeTask: task(function* (task) { | |
| yield task; | |
| yield timeout(1000) | |
| this.get('close')(); | |
| }) | |
| }); |
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'; | |
| import { task, timeout } from 'ember-concurrency'; | |
| const { inject: { service } } = Ember; | |
| export default Ember.Controller.extend({ | |
| notify: service(), | |
| appName: 'Ember Twiddle', | |
| testTask: task(function* () { | |
| console.log('task started'); | |
| yield timeout(1000); | |
| console.log('task complete'); | |
| }), | |
| actions: { | |
| notify() { | |
| let testTask = this.get('testTask').perform(); | |
| this.get('notify').info({component: 'custom-notification', text: "alert", task: testTask}); | |
| }, | |
| notifyPlain() { | |
| this.get('notify').info('simple text notification'); | |
| }, | |
| oncloseaction(close) { | |
| alert('closing') | |
| close(); | |
| } | |
| } | |
| }); |
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.11.1", | |
| "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.11.0", | |
| "ember-data": "2.11.0", | |
| "ember-template-compiler": "2.11.0", | |
| "ember-testing": "2.11.0" | |
| }, | |
| "addons": { | |
| "ember-notify": "5.2.1", | |
| "ember-concurrency": "0.7.19" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment