Created
November 4, 2013 17:59
-
-
Save jpadilla/7306653 to your computer and use it in GitHub Desktop.
WIP Ember.js Adapter for Sails.js
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
module.exports = App.ApplicationAdapter = DS.RESTAdapter.extend | |
init: -> | |
@_super() | |
pathForType: (type) -> | |
@type = type | |
return type | |
ajax: (url, method, hash) -> | |
adapter = this | |
new Ember.RSVP.Promise (resolve, reject) -> | |
hash.callback = (obj) -> | |
unless Ember.isNone obj.status | |
Ember.run null, reject, obj | |
else | |
result = {} | |
result[adapter.type] = obj | |
Ember.run null, resolve, result | |
socket.request url, hash.data, hash.callback, method.toLowerCase() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment