by gberger · 12y ago · 0 comments
//here's an AJAX request and a chain of promises
m.request({method: "GET", url: "/api/projects"})
.then(console.log) // log all projects
.then(pastItems) // filter past projects
.then(console.log) // log past projects only
The calls to console.log will not work.You need to do this:
.then(function() { console.log(arguments); })
Or this: .then(console.log.bind(console))I propose 'parry' for "partial application", to satisfy the punsters without compromising accuracy.
console.log.bind(console)
doesn't work in old IE you need to do Function.prototype.bind.call(console.log, console)On firefox I get
>>> console.log.call(undefined, "Hi")
Hi