going thru the quick start, i see this:
db.on('error', console.error.bind(console, 'connection error:'));
i’m not familiar with that console.error.bind
syntax, can someone set me straight?
regards,
tony.
--
Documentation - http://mongoosejs.com/
Plugins - http://plugins.mongoosejs.com/
Bug Reports - http://github.com/learnboost/mongoose
Production Examples - http://mongoosejs.tumblr.com/
StackOverflow - http://stackoverflow.com/questions/tagged/mongoose
Google Groups - https://groups.google.com/forum/?fromgroups#!forum/mongoose-orm
Twitter - https://twitter.com/mongoosejs
IRC - #mongoosejs
---
You received this message because you are subscribed to the Google Groups "Mongoose Node.JS ODM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-orm...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
thanks jason,
now that you refreshed my memory, i’ve seen that core js bind()
before.
i guess since:
(a) my head was in mongoose
and
(b) every time i read about bind()
my brain tucks it away in the “advanced stuff i won’t be using soon” junk drawer,
it didn’t click…
i should remember it now, at least to save my self some embarrassment ;)
then let me rephrase my original question to:
can anyone very briefly explain why we need to use bind()
here:
db.on('error', console.error.bind(console, 'connection error:'));
like, could we have avoided bind()
with something like:
db.on('error', function(err) { console.error('connection error: %s', err); })
?