Deferreds — Lightning talk notes

  • Deferreds are values that might not exist yet
  • But callbacks are used for letting you know that values exist
  • Deferreds are objects — they can be passed about
  • Deferreds can be successful and fail — so we do not have to use sentinel values
  • Deferreds’ callback/errback can be chained
  • A failed callback/errback calls the next errback in the chain
  • A successful callback/errback calls the next callback in the chain
  • If you like being able to find your bugs finish your deferres with log.err
  • Use defer.succeed/defer.fail to make sure you’re always retunring the same type
  • Use maybeDeferred to make sure that your users are not paying for your infrastructure’s mistake
About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 309 other followers

%d bloggers like this: