Skip to content
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

Simplify scan() #569

Closed
zolkis opened this issue Apr 30, 2020 · 3 comments
Closed

Simplify scan() #569

zolkis opened this issue Apr 30, 2020 · 3 comments

Comments

@zolkis
Copy link
Contributor

zolkis commented Apr 30, 2020

After filtering is gone and we have separate readers each with internal slots, IMHO we could simplify scans:

@kenchris
Copy link
Contributor

No, let's not do that please - multiple reasons :-)

  1. scan initiates polling and that is also needed for writing, so this would screw up letting people in control of what is happening and easily implement timeouts, ignore reads while writing etc.

It is also needed for TNEP communication, which is not a just-read-one-value and your are done mode.

  1. That is needed as we are not doing 1.

Not sure about 3. with the above answers.

With all of that said, today write() has a bit of magic which might be fine for the simple case, ie. it basically does what you suggest scan() would do above.

Another option would be doing similar (and similar to what we wanted to do for GeolocationSensor which got abandoned for now) - ie adding the convenience of a read() method that does a single read. Then in return, rename scan() to start() and add a stop()

@zolkis
Copy link
Contributor Author

zolkis commented May 1, 2020

adding the convenience of a read() method that does a single read.

This crossed my mind, too.
We could leave scan() as it is with AbortController (for which we received dev feedback to keep).

Anyway it's a convenience and someone can implement it with scan(), so I am not sure it's worth doing. Maybe we could include an example on how to implement a simple read() that resolves with the data?

@kenchris
Copy link
Contributor

kenchris commented May 1, 2020

That example exists in my latest PR

@zolkis zolkis closed this as completed May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants