[Laszlo-dev] how do I check for the existence of an attribute?

Sarah Allen sarah at ultrasaurus.com
Tue Feb 10 05:57:30 PST 2009


what is a views 'capabilities' list?

On Feb 10, 2009, at 4:32 AM, P T Withington wrote:

> Shouldn't the existence of a microphone be in the view's  
> `capabilities` list?
>
> On 2009-02-09, at 21:34EST, Max Carlson wrote:
>
>> Videoview.mic could be initialized to false and you could test for  
>> that value explicitly, to differentiate against null.
>>
>> I'll try that with the change you sent me for review...
>>
>> Sarah Allen wrote:
>>> The microphone has the following code:
>>>           // Use duck typing to check for the existence of the
>>>           // _setMic method, instead of checking if the
>>>           // immediateparent is an instance of videoview, to avoid
>>>           // loading the videoview class if it's not needed.
>>>           if (immediateparent['_setMic']) {
>>>               immediateparent._setMic(this);
>>>           }
>>> This doesn't work because videoview no longer has a setMic  
>>> method.  Instead, we're supposed to use setAttribute...
>>> However, then we would need to write:
>>>           if (immediateparent['mic']) {
>>>               immediateparent.setAttribute('mic', this);
>>>           }
>>> except that won't work since mic is intialized to null and  
>>> immediateparent['mic'] will evaluate to false.
>>> Any syntax gurus in the house?
>>> Thanks,
>>> Sarah
>>
>> -- 
>> Regards,
>> Max Carlson
>> OpenLaszlo.org
>



More information about the Laszlo-dev mailing list