W3C home > Mailing lists > Public > public-device-apis@w3.org > June 2015

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

From: Jafar Husain via GitHub <sysbot+gh@w3.org>
Date: Tue, 02 Jun 2015 18:35:27 +0000
To: public-device-apis@w3.org
Message-ID: <issue_comment.created-108047308-1433270126-sysbot+gh@w3.org>
I would definitely prefer an eventemitter to extending event target, 
but I'd prefer an Observable to both. Doubling down on EventTarget by 
adding yet more semantics doesn't make sense to sense to me. I also 
think it's easier said than done. 

One nice thing about Observable is that you can declaratively start 
listening to one sensor when a message arrives from another:

var values = sensor1.takeWhile(pos => pos.x - pos.y > 
0).concat(sensor2);

Combinators like concatenation are possible because Observables, like 
Iterables, have a concrete notion of completion. @domenic Would you 
add the notion of completion to EventTarget? How would that be 
communicated? Would unsubscription be implied? Would it integrate is 
well with existing features like generators as observable?

It would really nice to see something concrete in terms of a proposal 
about how event target composition would work (if that is indeed what 
you are proposing). Maybe you could work something up? 

-- 
GitHub Notif of comment by jhusain
See https://github.com/w3c/sensors/issues/21#issuecomment-108047308
Received on Tuesday, 2 June 2015 18:35:28 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 14:54:05 UTC