[Laszlo-dev] Should this code go into the SWF runtime?
P T Withington
ptw at openlaszlo.org
Fri Apr 7 00:01:21 EDT 2006
Belay that. Not sure what I was thinking here.
It would be an optimization to not call sendEvent if the event's
delegateList was empty. At least in the swf runtime, where function
calls are costly.
But I'm not sure this is the whole answer. It looks like you are
trying to create some sort of 'null' event for each declaration. If
you do this, you also need to check for this null event when you do
add a delegate (and convert it into a real event).
On 2006-04-06, at 20:38 PDT, Henry Minsky wrote:
> So that needs to be a convention that everyone obeys when they
> write calls
> to sendEvent? Not just in the LFC, I'm just thinking about user
> code, if app
> developers are going to be told to do
>
> if (foo.someevent) foo.someevent.sendEvent()
>
> instead of
>
> foo.someevent.sendEvent()
>
>
> Or is there some kind of magic we could use to do this
> automatically ? I
> guess it would need to be some kind of macro processor :-)
>
>
>
>
>
>
>
>
>
> On 4/6/06, P T Withington <ptw at openlaszlo.org> wrote:
>>
>> If you do, annotate LPP-1915 to say this can be removed when all
>> callers of sendEvent check for no listeners first (which should be
>> much more efficient than making a call to the empty function).
>>
>> On 2006-04-06, at 19:56 PDT, Henry Minsky wrote:
>>
>>>
>>> This code for declaring events is currently in the DHTML runtime
>>> but not in the SWF runtime.
>>>
>>> Should this go into the SWF runtime as is, or is there anything we
>>> need to do differently?
>>>
>>> [background for the viewing audience; we need to avoid referencing
>>> properties of null values
>>> in the DHTML runtime, as it brings the browser javascript
>>> interpreter to a screeching halt]
>>>
>>>
>>>
>>>
>>> LzDeclaredEvent = {};
>>> LzDeclaredEvent.sendEvent = function ( a ){ return a };
>>> LzDeclaredEvent.toString = function ( ){
>>> return "Declared event";
>>> }
>>>
>>> function DeclareEvent( who , what ){
>>> // debug('declare ' + who + ' what ' + what);
>>> who[ what ] = LzDeclaredEvent;
>>> }
>>> function DeclareEvents( who , what ){
>>> // debug('DeclareEvents', who, what);
>>> for (var i in what) {
>>> //info('what', what[i]);
>>> who[what[i]] = LzDeclaredEvent;
>>> }
>>> }
>>>
>>>
>>>
>>>
>>> --
>>> Henry Minsky
>>> Software Architect
>>> hminsky at laszlosystems.com
>>>
>>> _______________________________________________
>>> Laszlo-dev mailing list
>>> Laszlo-dev at openlaszlo.org
>>> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>>
>>
>
>
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
More information about the Laszlo-dev
mailing list