Created
November 5, 2011 10:00
-
-
Save julianshen/1341345 to your computer and use it in GitHub Desktop.
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
Ext.define('Ext.data.proxy.Facebook', { | |
extend: 'Ext.data.proxy.Proxy', | |
alias: 'proxy.facebook', | |
constructor: function(config) { | |
this.callParent([config]); | |
this.api = config.api; | |
//ensures that the reader has been instantiated properly | |
this.setReader(this.reader); | |
}, | |
read: function(operation, callback, scope) { | |
var me = this; | |
FB.api(me.api, function(result) { | |
var reader = me.getReader(); | |
var resultSet = reader.read(result.data); | |
Ext.apply(operation, { | |
resultSet: resultSet | |
}); | |
operation.setCompleted(); | |
operation.setSuccessful(); | |
Ext.callback(callback, scope || me, [operation]); | |
}); | |
}, | |
clear: Ext.emptyFn | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment