Skip to content

Instantly share code, notes, and snippets.

@dagda1
Created March 4, 2014 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dagda1/9340686 to your computer and use it in GitHub Desktop.
Save dagda1/9340686 to your computer and use it in GitHub Desktop.
BulkLoader.prototype.load = function(callback){
var self = this;
return new RSVP.Promise(function(resolve, reject) {
return getJSON('/login').then(function(token) {
return RSVP.hash({
users: getJSON('/users'),
contacts: getJSON('/contacts'),
companies: getJSON('/companies')
}).then(function(hash) {
self.users = hash.users;
self.companies = hash.companies;
self.contacts = hash.contacts;
return resolve(self);
});
});
}).catch(errorHandler);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment