-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add traverse function #141
Comments
The reason for this suggestion is mainly, that #140 and similar features would be easier to add once solid-file-client supports a common traversal method |
@CxRes - have you seen this? How do you think it might relate to your unified functions PR? |
In principle, this is a nice idea. In practice, it is a little more tricky. As I have noted elsewhere, one of my design goals is to minimize the number of times we hit the network, even if that means a little more code. For the unified For Another thing for the design, there should be one function which has a pre and a post callback, I cannot think of a scenario right now but, it seems to be more general! More generally, I was thinking about requesting a file walker, and a walker needs traversal! |
Description
I think that we will need to iterate recursively over all items of a folder in multiple methods, hence a common traverse method for this seems adequate. It could be called on a folder, and then execute a callback for each item in it. Depending on the settings/implementation it uses a different callback order (parents before contents / contents before parent) and depth.
Use cases
Features / options
I think the hardest part about the implementation, is to decide what should be supported. Important features are in my opinion:
Implementation
Here is a simplistic version of how it could be implemented and used (in pseudo-javascript):
This could be used like this:
The text was updated successfully, but these errors were encountered: