Re: change proposal for Telephony API

On Mon, Apr 22, 2013 at 12:51 PM, Kis, Zoltan <zoltan.kis@intel.com> wrote:
>> So I don't have a strong opinion one way or another.
>>
>> However one thing that will not work in the new proposal is the
>> synchronous API for enabling/disabling a service. Surely that needs to
>> be an asynchronous operation?
>
> Yes, surely, it is. The description should be more clear on this, i.e.
> setting the property just starts the operation. When the service is
> actually enabled or disabled, an event is generated and the handlers
> are called (onserviceadded, onserviceremoved).

Surely the services are available through the .services array even
when they are disabled? Otherwise you can't get to them and enable
them?

The problem with using an attribute is what do they return once you've set them?

service.enabled = true;
service.enabled; // returns true or false?

If service.enabled returns false, then that's confusing because you
just set it to true and attributes generally change their value to
whatever value was set.
If service.enabled returns true, then that's confusing because the
service hasn't actually yet been enabled and might not be since there
might be an error of some sort.

Instead it's better to have a setEnabled(boolean enabled) function
which returns a DOMRequest (soon to be changed to Future), and next to
it a readonly attribute enabled flag. That way you can check the
current status and it's clear that enabling/disabling will happen
asynchronously.

/ Jonas

Received on Tuesday, 23 April 2013 00:45:08 UTC