Skip to content

Instantly share code, notes, and snippets.

@julianshen
Created November 5, 2011 10:00
Show Gist options
  • Save julianshen/1341345 to your computer and use it in GitHub Desktop.
Save julianshen/1341345 to your computer and use it in GitHub Desktop.
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