-
-
Save mydea/040c01c637dc2f036c237a3c38ab46ce to your computer and use it in GitHub Desktop.
New Twiddle
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 JSONAPIAdapter from 'ember-data/adapters/json-api'; | |
import AdapterFetch from 'ember-fetch/mixins/adapter-fetch'; | |
export default JSONAPIAdapter.extend(AdapterFetch, { | |
ajax() { | |
let promise = this._super(...arguments); | |
promise.finally(() => console.log('done')); | |
return promise; | |
}, | |
}); |
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'; | |
import { task, timeout, waitForProperty } from 'ember-concurrency'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
lol: false, | |
foo: task(function * () { | |
let { store } = this; | |
let model = store.createRecord('test-model'); | |
try { | |
yield model.save(); | |
} catch(error) { | |
console.log('ERROR', error); | |
throw error; | |
} | |
console.log('DONE'); | |
}), | |
actions: { | |
setLolToTrue() { | |
this.set('lol', Math.random()); | |
} | |
} | |
}); |
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 Model from 'ember-data/model'; | |
export default Model.extend({ | |
}); |
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.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", | |
"ember-concurrency": "0.8.27", | |
"ember-fetch": "latest" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment