-
Notifications
You must be signed in to change notification settings - Fork 361
Change tree directory loading to use async IO calls #344
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this changed to use a promise? It doesn't seem like the promise is used anywhere, apologies if I'm missing something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, int this package, promises aren't used anywhere else and this PR introduces with requiring Q
personally, I don't like promises, but I wanted to be consistent with Atom's core usages of promises.
Since the package was doing most of the code synchronously, there wasn't a clear cut for me whether to use promises or callbacks.
I don't mind refactoring it back to callback if you think including q and using promises is confusing for this package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I'm totally cool using promises in this package.
I just didn't see why it was needed in this specific case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 just for standardizing a away to do async stuff
Just curious, what will happen if you open and close a directory quickly multiple times and multiple promises get created to list/create the entries? How is that handled? |
I see that the rendering of that is handled by the |
lib/directory.coffee
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These ()
aren't needed.
Maybe in the future, the tree directory and file classes should inherit from the Atom API's File/Directory classes which now exist in
node-pathwatcher
Related, but not a dependency: atom/node-pathwatcher#56