W3C home > Mailing lists > Public > public-web-bluetooth-log@w3.org > January 2016

Re: [web-bluetooth] Update 'script execution context' reference to refer to a `Bluetooth` instance

From: Boris Zbarsky via GitHub <sysbot+gh@w3.org>
Date: Tue, 12 Jan 2016 04:05:29 +0000
To: public-web-bluetooth-log@w3.org
Message-ID: <issue_comment.created-170779817-1452571527-sysbot+gh@w3.org>
> only gets one BluetoothDevice, BluetoothGattService, etc. instance.

@jyasskin I assume you mean "one instance per global", right?

I do think that using the global that the `Bluetooth` instance is 
associated with would make sense to use here.  The relevant IDL 
wording is precisely that.  
http://heycam.github.io/webidl/#es-platform-objects says:

    Every platform object is associated with a global environment, 
just as the initial objects are.
    It is the responsibility of specifications using Web IDL to state 
which global environment (or, by
    proxy, which global object) each platform object is associated 
with. 

So your "extensions to the Navigator interface" section would define 
which global the returned `Bluetooth` instance is associated with and 
your definition of requestDevice (which I assume is the relevant API 
here) would look for an existing `BluetoothDevice` that matches 
whatever criteria and is associated with the same global, and if that 
doesn't exist, create it, and associate it with the global `this` is 
associated with. 

That said, since it sounds like you want to preserve its identity 
forever, you can probably just cache it in the `Bluetooth` instance so
 this all only matters in terms of defining the global the 
`BluetoothDevice` itself is associated with, right?

-- 
GitHub Notification of comment by bzbarsky
Please view or discuss this issue at 
https://github.com/WebBluetoothCG/web-bluetooth/issues/196#issuecomment-170779817
 using your GitHub account
Received on Tuesday, 12 January 2016 04:05:31 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 12 January 2016 04:05:32 UTC