- From: Alexandre Morgaut <alexandre.morgaut@wiztivi.com>
- Date: Thu, 29 Sep 2016 16:30:43 +0200
- To: Chris Needham <chris.needham@bbc.co.uk>
- Cc: "public-web-and-tv@w3.org" <public-web-and-tv@w3.org>
- Message-ID: <CAOMg--Mrv0nguvhczG-QNmFFwxc_wGQcHuxLp4BOMMERCm4YQw@mail.gmail.com>
Hi, And thanks Chris, as I can not directly participate to those Working Group Meetings (not W3C Member any more), it is good to still be able to follow. I don't won't to look rude or like trolling or anything, but I think it is important to make examples that better use promises, for which, one of the announced purpose is to prevent issues like "callback hell". it is not just a kind of dev preference, but I think it is also even more important in presentations to better understand the presented execution steps Such code using promise based APIs (slide 5) navigator.tv.getTuners().then(function(tuners) { var tuner = tuners[0]; tuner.setCurrentSource("dvb-t2").then(function() { tuner.currentSource.setCurrentChannel("101").then(function() { videoElement.srcObject = tuner.stream; } } }); Is (I think) better meant to be written (with a more readable process) at least as (in ES5) navigator.tv.getTuners().then(function(tuners) { var tuner = tuners[0]; return tuner.setCurrentSource("dvb-t2"); }).then(function() { return tuner.currentSource.setCurrentChannel("101"); }).then(function() { videoElement.srcObject = tuner.stream; }); Such code structure is also more similar to what ES6 users would have written navigator.tv.getTuners() .then(tuners => { var tuner = tuners[0]; return tuner.setCurrentSource("dvb-t2"); }) .then(() => tuner.currentSource.setCurrentChannel("101")) .then(() => videoElement.srcObject = tuner.stream); (Just for fun) As to what ES8 users start to be able to write async function play() { var tuners = async navigator.tv.getTuners(); var tuner = tuners[0]; await tuner.setCurrentSource("dvb-t2"); await tuner.currentSource.setCurrentChannel("101"); videoElement.srcObject = tuner.stream; } I don't care to see any of the 3 (ES5 / ES6 / ES8) mentioned variants, as, even if the last one is probably the most "right to the point" version, some may not be yet very comfortable with the more recent Arrow or async functions. But I think it could be a good thing to at least prevent from using code structures as the one in slides 5 and 6 Regards, Alexandre 2016-09-19 17:17 GMT+02:00 Chris Needham <chris.needham@bbc.co.uk>: > Hi all, > > Please find attached the slides from the Web and TV IG / TV Control WG > joint meeting this morning. > > Best regards, > > Chris (TV Control WG Chair) > > > ----------------------------- > http://www.bbc.co.uk > This e-mail (and any attachments) is confidential and > may contain personal views which are not the views of the BBC unless > specifically stated. > If you have received it in > error, please delete it from your system. > Do not use, copy or disclose the > information in any way nor act in reliance on it and notify the sender > immediately. > Please note that the BBC monitors e-mails > sent or received. > Further communication will signify your consent to > this. > ----------------------------- > -- [image: wiztivi-logo] <http://www.wiztivi.com/> *Alexandre Morgaut* | Web Architect - Project Manager +33 6 26 25 29 04 @amorgaut <https://twitter.com/amorgaut> *wiztivi.com <http://www.wiztivi.com/>* 2 bis avenue du Professeur Jean Rouxel 44481 Carquefou CEDEX - France
Received on Thursday, 29 September 2016 14:31:34 UTC