Re: [web-nfc] Consider removing .nfc namespace

However, it is tricky to handle errors with the merged model. If you 
have multiple adapters, and a push, or setting a watch succeeds on 
some of them and fails on others, how do we handle the situation?

If we say succeeding on any adapter is success, from where would the 
user know which adapter is usable?

Without explicit adapter enumeration and management (which I would 
like to avoid), what is better: 
1. making the user, or the UA select an adapter, then every NFC 
operation belongs to that adapter, or
2. using all adapters transparently (those that have a connected 
device), and consider any success a success and resolve the Promise, 
or
3. using all adapters transparently (those that have a connected 
device), and consider any failure a failure and reject the Promise.

Note that 1. is possible with the navigator.nfc model as well, e.g. 

1.a.) by using a Web NFC specific policy, like:
- select the built-in adapter if no external is connected and there is
 only one built-in adapter, or 
- select the connected adapter if only one external adapter is 
connected, 
- otherwise show a dialog when ```nfc.push()``` or ```nfc.watch()``` 
is invoked first time (but then you cannot change it until the page is
 reloaded), 

or

1.b.) by using an explicit (new) ```nfc.selectAdapter()``` method 
which triggers a selection dialog, but the default policy would be 
active (i.e. there always would be a default adapter, if there is 
any).

Please choose between 1.a., 1.b., 2, 3, or propose another policy.

Personally I would be most comfortable with 1.b. (or 1.a. in the first
 version), and I would like to avoid using all the adapters in 
parallel (2 and 3).

In this case the API would look like:
```javascript
partial interface Navigator {
    readonly attribute NFC nfc;
};

interface NFC {
    Promise<void> push(NFCMessage message, optional NFCPushOptions 
options);
    void cancelPush(NFCPushTarget target);

    Promise<long> watch(NFCWatchOptions options, MessageCallback 
callback);
    Promise<void> unwatch(long id);

   // Promise<void> selectAdapter();  // triggers a dialog
};
```

(NB. The other proposed changes, e.g. content handling and removing 
push target etc. will be discussed separately)

-- 
GitHub Notif of comment by zolkis
See https://github.com/w3c/web-nfc/issues/67#issuecomment-151172158

Received on Monday, 26 October 2015 15:22:38 UTC