Re: [sensors] Dependency on [DOM] due to inheriting from EventTarget

@tobie, I think behaviors and observers would implement the iterator 
interface. next() would pull the current sensor value, or capture the 
most recently emitted sensor value. For behaviors that do not have a 
beginning or end, I think it would be reasonable to also implement 
now(), that would just return the value. Observers would additionally 
have methods like "forEach", which would call the callback on the 
stack whenever the underlying sensor emitted a value. I do not think 
you get away with just one or the other since sensors have different 
underlying semantics. Continuous sensors that pull data, e.g., 
temperature, would be appropriate for a behavior. Discrete sensors 
that push data, e.g., a counter, would be appropriate for an observer.
 For observers, it is useful to have a distinct observable, to 
refcount consumers and go either hot or cold depending on whether 
anyone’s watching. That’s the summary.

This is the most recent observable proposal from the @zenparsing + 
@jhusain convergence https://github.com/zenparsing/es-observable

-- 
GitHub Notif of comment by kriskowal
See https://github.com/w3c/sensors/issues/21#issuecomment-107121710

Received on Sunday, 31 May 2015 03:46:57 UTC