[Laszlo-dev] For Review: Change 20070719-maxcarlson-r Summary: Only send events when there is a delegate ready to listen

Max Carlson max at openlaszlo.org
Thu Jul 19 18:30:57 PDT 2007


I did some experimenting and wasn't able to get LzEvent.prototype = 
Array() to work:

lzx> LzEvent
«Function#0| events/LaszloEvents.lzs#341/15»
lzx> LzEvent.length
WARNING: interactive-eval-2: reference to undefined property 'length'
lzx> LzEvent.push('foo')
ERROR: interactive-eval-3:-1: call to undefined method 'push'

Too bad.  I like this idea!

I could make LzEvent a regular object instead of a Class, but then I'm 
worried about LzEvent.make() not existing if someone in userland decides 
to new one.

And yes, we do need macros/inlining badly - sendEvent and CSSDimension 
both come to mind!

So, do you approve of the checkin for now :)?

P T Withington wrote:
> What do you think about making LzEvent an array with properties instead 
> of an object with an array?  The array would be the delegate list, 
> instead of having the delegate list be one of the properties.  And then 
> the 'ready' flag is just LzEvent.length > 0.
> 
> Just throwing this out as an idea, since you are touching all these files.
> 
> (I suspect Array.push used to be slow in AS, which is why 
> evq[evq.langth] was used.)
> 
> And I realize what you really want is sendEvent to be a macro or inlined...
> 
> On 2007-07-19, at 15:31 EDT, Max Carlson wrote:
> 
>> Change 20070719-maxcarlson-r by maxcarlson at plastik on 2007-07-19 
>> 11:16:47 PDT
>>     in /Users/maxcarlson/openlaszlo/legals-checkin
>>     for http://svn.openlaszlo.org/openlaszlo/branches/legals
>>
>> Summary: Only send events when there is a delegate ready to listen
>>
>> New Features:
>>
>> Bugs Fixed: LPP-4330 - Only send events when there is a delegate ready 
>> to listen
>>
>> Technical Reviewer: promanik
>> QA Reviewer: ptw
>> Doc Reviewer: (pending)
>>
>> Documentation:
>>
>> Release Notes:
>>
>> Details: LzDefs.lzs - Add LzDeclaredEvent.ready = false flag. 
>> toString() returns the classname.
>>
>> LaszloEvents.lzs -  Add LzDeclaredEvent.ready flag, defaulting to 
>> false.  Set ready to true when delegateList length > 0.  Use array.ush 
>> instead of evq[evq.length].  Cache keep length.
>>
>> LzTextSprite.as - Use __lzview instead of __control - should fix 
>> __updatefieldsize().  Check event ready flag before calling sendEvent().
>>
>> LzInputTextSprite.as - Make constructor more similar to LzTextSprite.
>>
>> Check event ready flag before calling sendEvent(), except where noted:
>> kernel/swf/LzLoader.lzs
>> kernel/swf/LzMediaLoader.lzs
>> kernel/swf/LzContextMenu.lzs
>> kernel/swf/LzLoadQueue.lzs
>> kernel/swf/LzLibraryLoader.lzs
>> kernel/swf/LzMakeLoadSprite.lzs
>> kernel/swf/LzSprite.lzs
>> kernel/dhtml/LzContextMenu.lzs
>> kernel/LzLibraryCleanup.lzs
>> services/LzTrack.lzs
>> services/platform/swf/LzKeys.as
>> services/platform/swf/LzHistory.as
>> services/platform/dhtml/LzHistory.js
>> services/platform/dhtml/LzKeys.js
>> services/LzGlobalMouse.lzs
>> services/LzIdle.lzs
>> services/LzFocus.lzs
>> services/LzModeManager.lzs
>> core/LzNode.lzs
>> views/LzInputText.lzs
>> views/LzText.lzs - Remove unused __updatefieldsize() method.
>> views/LaszloView.lzs
>> views/LaszloCanvas.lzs
>> helpers/LzCommand.lzs
>> helpers/LzState.lzs
>> controllers/LzAnimatorGroup.lzs
>> controllers/LaszloAnimation.lzs
>> data/LzReplicationManager.lzs
>> data/LzLazyReplicationManager.lzs
>> data/platform/swf/LzConnection.lzs
>> data/LzDatapointer.lzs
>> data/LzDataText.lzs
>> data/LzDataNode.lzs
>> data/LzDataElement.lzs
>> data/LzDataset.lzs
>> data/LzResizeReplicationManager.lzs
>> data/LzDatapath.lzs
>>
>> Tests: ant lztest.  All applications run as before.  Firebug shows 
>> 5545 less function calls for 
>> examples/components/style_example.lzx?lzt=html&lzr=dhtml.  
>> LzDeclaredEvent.sendEvent() goes from being the second most frequently 
>> called method at 6171 calls to 476 calls.
>>
>> Files:
>> M      WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
>> M      WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs
>> M      WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs
>> M      WEB-INF/lps/lfc/kernel/swf/LzContextMenu.lzs
>> M      WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as
>> M      WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as
>> M      WEB-INF/lps/lfc/kernel/swf/LzLibraryLoader.lzs
>> M      WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as
>> M      WEB-INF/lps/lfc/kernel/swf/LzSprite.as
>> M      WEB-INF/lps/lfc/kernel/dhtml/LzContextMenu.js
>> M      WEB-INF/lps/lfc/kernel/LzLibraryCleanup.lzs
>> M      WEB-INF/lps/lfc/services/LzTrack.lzs
>> M      WEB-INF/lps/lfc/services/platform/swf/LzKeys.as
>> M      WEB-INF/lps/lfc/services/platform/swf/LzHistory.as
>> M      WEB-INF/lps/lfc/services/platform/dhtml/LzHistory.js
>> M      WEB-INF/lps/lfc/services/platform/dhtml/LzKeys.js
>> M      WEB-INF/lps/lfc/services/LzGlobalMouse.lzs
>> M      WEB-INF/lps/lfc/services/LzIdle.lzs
>> M      WEB-INF/lps/lfc/services/LzFocus.lzs
>> M      WEB-INF/lps/lfc/services/LzModeManager.lzs
>> M      WEB-INF/lps/lfc/core/LzNode.lzs
>> M      WEB-INF/lps/lfc/core/LzDefs.lzs
>> M      WEB-INF/lps/lfc/views/LzInputText.lzs
>> M      WEB-INF/lps/lfc/views/LzText.lzs
>> M      WEB-INF/lps/lfc/views/LaszloView.lzs
>> M      WEB-INF/lps/lfc/views/LaszloCanvas.lzs
>> M      WEB-INF/lps/lfc/helpers/LzCommand.lzs
>> M      WEB-INF/lps/lfc/helpers/LzState.lzs
>> M      WEB-INF/lps/lfc/events/LaszloEvents.lzs
>> M      WEB-INF/lps/lfc/controllers/LzAnimatorGroup.lzs
>> M      WEB-INF/lps/lfc/controllers/LaszloAnimation.lzs
>> M      WEB-INF/lps/lfc/data/LzReplicationManager.lzs
>> M      WEB-INF/lps/lfc/data/LzLazyReplicationManager.lzs
>> M      WEB-INF/lps/lfc/data/platform/swf/LzConnection.lzs
>> M      WEB-INF/lps/lfc/data/LzDatapointer.lzs
>> M      WEB-INF/lps/lfc/data/LzDataText.lzs
>> M      WEB-INF/lps/lfc/data/LzDataNode.lzs
>> M      WEB-INF/lps/lfc/data/LzDataElement.lzs
>> M      WEB-INF/lps/lfc/data/LzDataset.lzs
>> M      WEB-INF/lps/lfc/data/LzResizeReplicationManager.lzs
>> M      WEB-INF/lps/lfc/data/LzDatapath.lzs
>>
>> Changeset: 
>> http://svn.openlaszlo.org/openlaszlo/patches/20070719-maxcarlson-r.tar
> 

-- 
Regards,
Max Carlson
OpenLaszlo.org


More information about the Laszlo-dev mailing list