Last active
April 5, 2017 19:41
-
-
Save mmun/6bc630a36d36aedde158 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 DS from 'ember-data'; | |
export default DS.RESTAdapter; |
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'; | |
export default Ember.Controller.extend({ | |
actions: { | |
saveCount(event) { | |
let model = this.get('model'); | |
let value = parseInt(event.target.value); | |
model.set('count', value); | |
model.save(); | |
} | |
} | |
}); |
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'; | |
new Pretender(function() { | |
this.get('/counters/123', function() { | |
return [200, {}, JSON.stringify({ | |
counter: { id: '123', count: 0 } | |
})]; | |
}, 1000); | |
this.put('/counters/123', function(request) { | |
let count = JSON.parse(request.requestBody).counter.count; | |
return [200, {}, JSON.stringify({ | |
counter: { id: '123', count: count } | |
})]; | |
}, 1000); | |
}); | |
export default Ember.Route.extend({ | |
model() { | |
return this.store.find('counter', '123'); | |
} | |
}); |
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 DS from 'ember-data'; | |
export default DS.Model.extend({ | |
count: DS.attr('number') | |
}); |
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.6.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.3.1/ember.debug.js", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.3.3/ember-data.js", | |
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.3.1/ember-template-compiler.js", | |
"route-recognizer": "https://npmcdn.com/[email protected]", | |
"fake-xml-http-request": "https://npmcdn.com/[email protected]", | |
"pretender": "https://npmcdn.com/[email protected]" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment