Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Conversation

mostafaeweda
Copy link

Related, but not a dependency: atom/node-pathwatcher#56

Copy link
Contributor

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.

Copy link
Author

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

Copy link
Contributor

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.

Copy link
Author

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

@kevinsawicki
Copy link
Contributor

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?

@mostafaeweda
Copy link
Author

I see that the rendering of that is handled by the directory-view to remove items on collabse and https://github.com/mostafaeweda/tree-view/blob/master/lib/directory-view.coffee#L118 and the onDid$ events and subscriptions are making sure the listing under the directory is always in sync with the most recent resolved promise results.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These () aren't needed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants