[Laszlo-dev] how do I check for the existence of an attribute?
Sarah Allen
sarah at ultrasaurus.com
Tue Feb 10 10:12:28 PST 2009
I notice that there is a capabilities property in the v4 doc for view
(but no description):
http://www.openlaszlo.org/lps4/docs/reference/LzView.html
but not in the 4.2 doc:
http://www.openlaszlo.org/lps4.2/docs/reference/
It sound promising though...
Sarah
On Feb 10, 2009, at 5:57 AM, Sarah Allen wrote:
> 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