Last active
March 9, 2017 09:46
-
-
Save LevelbossMike/4283805a7c716fb1acf24284ff0b9077 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'); | |
| } | |
| } | |
| }); |
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