Skip to content

Commit

Permalink
add promises section
Browse files Browse the repository at this point in the history
  • Loading branch information
max-mapper committed Jul 2, 2013
1 parent 647459d commit e6c5317
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1 +1 @@
this will contain information about using callbacks, events and streams to write javascript programs
this contains a page with information about using callbacks to write javascript programs
17 changes: 14 additions & 3 deletions index.html
Expand Up @@ -165,12 +165,23 @@

There are lots of module patterns for [web browser](http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth) and [on the server](http://nodejs.org/api/modules.html). Some of them get very complicated. The ones shown here are what I consider to be the simplest to understand.

### Additional reading
### I still don't get it

- [A pattern for decoupling DOM events from @dkastner](https://gist.github.com/3392235)
Try reading my [introduction to callbacks](https://github.com/maxogden/art-of-node#callbacks).

### What about promises?
[Promises](http://domenic.me/2012/10/14/youre-missing-the-point-of-promises/) are a more abstract pattern of working with async code in JavaScript.

The scope of this document is to show how to write vanilla javascript. If you use a third party library that adds abstraction to your JS then make sure you're willing to force everyone that contributes to your library to also have the same views on JS as you.

*Callback Hell is a work in progress -- check back later for more content.*
In my own personal experience I like to use nice and simple callbacks for 90% of the async code I wrote, and when things get hairy I bring in something like the [async](https://github.com/caolan/async) library.

That being said, everyone develops their own unique JavaScript style and you should do what you like. Just remember that there are no absolutes: some people like to use only callbacks, some people don't. You can't understand promises without understanding callbacks, but you can understand callbacks without understanding promises.

### Additional reading

- [A pattern for decoupling DOM events from @dkastner](https://gist.github.com/3392235)

Please contribute new sections or fix existing ones by [forking this project on github](http://github.com/maxogden/callback-hell)!
</div>
</div>
Expand Down

0 comments on commit e6c5317

Please sign in to comment.