W3C home > Mailing lists > Public > public-secondscreen@w3.org > October 2015

Re: [presentation-api] PresentationReceiver: rename getConnection() and getConnections()

From: Mounir Lamouri via GitHub <sysbot+gh@w3.org>
Date: Tue, 06 Oct 2015 16:22:26 +0000
To: public-secondscreen@w3.org
Message-ID: <issue_comment.created-145918011-1444148545-sysbot+gh@w3.org>
@avayvod and I talked to @jakearchibald and we came up with this 
proposition:
```idl
interface PresentationReceiver {
  Promise<> ready;
  sequence<PresentationConnection> connections;
  attribute EventHandler onconnectionavailable;
};
```

It made me wonder why we couldn't simply do:
```idl
interface PresentationReceiver {
  sequence<PresentationConnection> connections;
  attribute EventHandler onconnectionavailable;
};
```

It seems that if we accept that ```connections``` can be returned 
synchronously and the event will be fired when there is a new 
connection, pages could have code like:
```js
function handshake(c) {
   // ...
}

function onloadhandler() {
  navigator.presentation.receiver.onconnectionavailable = handshake;
  navigator.presentation.receiver.connections.forEach(handshake);
}
```

WDYT?

-- 
GitHub Notif of comment by mounirlamouri
See 
https://github.com/w3c/presentation-api/issues/201#issuecomment-145918011
Received on Tuesday, 6 October 2015 16:22:28 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 October 2015 16:22:28 UTC