Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
returns undefined ?
var Sync = function(syncing, options) {
this.syncing = syncing;
this.url = syncing.url;
this.delay = syncing.delay;
}
_.extend(Sync.prototype, {
findAll: Promise.method(function() {
var sync = this;
return Promise.bind(this).then(function() {
request.get(sync.url).set('x-delay', sync.delay).end(function(res) {
return res.text;
})
})
})
});
Collection = function() {}
_.extend(Collection.prototype, Events, {
sync: function(options) {
return new Sync(this, options);
},
fetch: Promise.method(function() {
this.trigger('fetching');
return this.sync()
.findAll()
.then(function(movies) {
console.log(movies);
return movies;
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.