medikoo / deferred

Modular and fast Promises implementation for JavaScript
ISC License
364 stars 20 forks source link

Examples #11

Closed madarche closed 11 years ago

madarche commented 11 years ago

Hello Mariusz,

Here is an example folder with a first example to start with.

I would like to provide more examples in the future.

Best regards,

medikoo commented 11 years ago

@madarche Great thanks, for that.

I'm however reluctant to take this.

  1. I partially like how you reedited the README.md, and partially dislike as some of the information is confusing, e.g. "Note: to run the example, simply concat all JavaScript files in a given directory and save it to lib.js", that gives notion that you expect someone to pack JS files to be able to run example
  2. Mocha example you provided is very basic, it's just about creation of deferred object and return of promise, there's also slight error, you need to return deferred.promise not deferred.promise(), technically it will work, but good example should do return deferred.promise.

We definitely need some examples list, and examples folder is a good idea, but maybe it would be better to start with something less obvious, like, how to work with Mongoose, how to write while loops. How to work with array of promises. Something that will solve real head scratchers.

If you feel you can improve that, I'll be willing to take it. Otherwise let's agree that, in next days I write few good examples for examples folder, and then I'll be open to take fixed mocha example from you as an addition.

madarche commented 11 years ago

Hello @medikoo, thanks for your reply.

  1. The wording that disturbs you in the README.md file is already present in the current version.
  2. Oh I'm sorry for the mistake about deferred.promise. I'm glad to have had your proofreading.

Sorry for those problems and I'll provide you with another pull request with the problematic points hopefully fixed.

Cheers

medikoo commented 11 years ago

@madarche I introduced examples in a README.md and added first while loop example, still If you feel README can be better I'm open for that.

I'd like to take your improved Mocha example. We can use same pull request (I've reopened the ticket), and it'll be great to fill this folder with more usable examples, so if you have other good cases in a sleeve, I'll be more than happy to include them.

medikoo commented 11 years ago

@madarche I'm gonna close it for now, please reopen when you have examples ready. Thanks!

madarche commented 11 years ago

Sorry for the delay, I've got the file fixed and ready to be contributed. But I haven't the right to reopen this pull request. Could you reopen it please?

medikoo commented 11 years ago

@madarche thanks, I've taken it in. I've actually also fixed formatting so it matches the conventions of the project. Some notes:

madarche commented 11 years ago

@medikoo I am keeping in mind all your recommendations and will follow them. And thanks again for your very helpful and appreciated proofreading. They help fixing/improving the projects that use deferred I'm working on.