Renaming thread. Another option is for the beads themselves to have event metadata for events they dispatch and either: 1) the bead dispatches both off of itself and its strand, or 2) certain addEventListener calls are passed to the strand.
That's sort of the general pattern for de-composing or "exploding" a component. And then the wrapping component doesn't need metadata that won't apply to the beads declared. Having a bead that can attach a particular kind of listener and call a handler also fits in our patterns. And similarly, a bead that dispatches platform-specific might be useful as well. My 2 cents, -Alex On 10/31/17, 3:15 AM, "Harbs" <[email protected]> wrote: >Good points. > >> One issue to consider are whether a container of beads should be have >> metadata about the events dispatched by its beads since the changing of >> beads could make that metadata incorrect. IMO, this has been a problem >>in >> Flex forever. Maybe a smarter IDE could figure out what beads are >> currently in play and aggregate allowable events from those beads' >> metadata someday. > >Hmm. Not a simple problem. One approach we can take is to add metadata to >the component and include documentation on which beads are required for >the event to fire. > >Of course this only takes care of more-or-less standard beads. Optional >beads that are generally not used would need another mechanism to specify >event handlers in MXML (if that would be supported). > >Considering the “smarter IDE approach”, it seems like there’s two >problems: >1. The compiler needs to know that the attributes are OK. Currently, the >compiler will complain if you use an unrecognized tag. >2. There’s lots of ways to add beads, and it’s hard to know if a specific >bead is actually added. They can be added using CSS, AS code and MXML. >Dynamically following that flow in tooling seems like a *really* hard >problem. > >Another idea would be to allow specifying event handlers in a format >something like this: ><js:FooComponent id=“foo”> ><js:events> ><js:EventDescriptor type”layoutNeeded” handler=“handleLayoutNeeded()”/> ></js:events> ></js:FooComponent> > >I’m kind of liking this idea as it follows the pattern we currently have >for beads and styles. EventDescriptor could be subclassed to have classes >of events which could offer code completion for the available event >types. There would not be enforcement that the events would actually be >dispatched, but I think it would be helpful and would allow users to >specify random event handlers declaratively. > >> Another issue to consider is cross-platform. A component may not be >>able >> to dispatch the events listed in metadata on all platforms. > >It seems to me that metadata on cross-platform components should always >be cross-platform. If there are platform-specific events, they should not >be included or there should be a platform-specific component. We’ve >already solved the problem with mouse events by renaming the event >strings in the compiler depending on the target. (i.e. “doubleClick” in >MXML becomes “dblclick” automatically for JS output). I think Mouse >events are an exception, but if there are any other events that fit this >exception, they should be handled the same way. > >> On Oct 30, 2017, at 8:41 PM, Alex Harui <[email protected]> >>wrote: >> >> Some Metadata is kept in the output, but events probably aren't. >> >> One issue to consider are whether a container of beads should be have >> metadata about the events dispatched by its beads since the changing of >> beads could make that metadata incorrect. IMO, this has been a problem >>in >> Flex forever. Maybe a smarter IDE could figure out what beads are >> currently in play and aggregate allowable events from those beads' >> metadata someday. >> >> Another issue to consider is cross-platform. A component may not be >>able >> to dispatch the events listed in metadata on all platforms. >> >> Also consider that on JS, events probably have to be propagated from the >> wrapped element to the strand so there is cost there. >> >> It is hopefully easy enough for anyone who wants to get an event that >> isn't already in metadata, to subclass, add the metadata and any wiring. >> >> My 2 cents, >> -Alex >> >> On 10/30/17, 11:24 AM, "Harbs" <[email protected] >><mailto:[email protected]>> wrote: >> >>> I’m not talking about adding events. I’m talking about adding metadata >>> for *existing events* so they could be addressed in MXML. >>> >>> >>>> On Oct 30, 2017, at 8:18 PM, Piotr Zarzycki >>>><[email protected]> >>>> wrote: >>>> >>>> If you decide to add event that's fine with me. :) It is just the >>>> matter of >>>> thinking about those Basic components from my sight. I have started to >>>> look >>>> at them as something which should be closer to HTML than to the old >>>>Flex >>>> world. Rest of the features should be provided by beads - if it is >>>> possible >>>> or by Express. >>>> >>>> The exception could be and MDL from that which I would like to extend, >>>> but >>>> here I can think about those components as they are Express right now. >>>> >>>> Piotr >>>> >>>> >>>> 2017-10-30 19:07 GMT+01:00 Harbs <[email protected]>: >>>> >>>>> Why? Unless it adds overhead, it seems to me like any event that can >>>>>be >>>>> added using addEventListener() should be addressable using MXML. >>>>> >>>>> I’m just not sure from a technical perspective whether the MXML meta >>>>> tags >>>>> add overhead if not used. >>>>> >>>>>> On Oct 30, 2017, at 8:02 PM, Piotr Zarzycki >>>>>> <[email protected]> >>>>> wrote: >>>>>> >>>>>> Hi Harbs, >>>>>> >>>>>> Some time ago there were discussion on Flex Dev which makes me >>>>>>realize >>>>> that >>>>>> we should add event tags as long as they are reflecting some native >>>>>> HTML >>>>>> api, unless we are in express. For example we are using in many >>>>>>places >>>>>> "change" event which is I believe quite common in JS world, but I >>>>>> would >>>>>> avoid any additional custom one. In the other world Let's answer to >>>>>> the >>>>>> question in following case - Does "img" in HTML world have "load" >>>>>> event ? >>>>>> >>>>>> Piotr >>>>>> >>>>>> >>>>>> 2017-10-30 18:47 GMT+01:00 Harbs <[email protected]>: >>>>>> >>>>>>> This does raise a good question: >>>>>>> >>>>>>> Should we be adding MXML meta tags for all supported events? It >>>>>>>seems >>>>> like >>>>>>> a desirable thing to have, and there are currently very few event >>>>>>> tags. >>>>> I’m >>>>>>> not clear on whether the meta-tags effect the end result of code >>>>>>> size. >>>>>>> >>>>>>> Harbs >>>>>>> >>>>>>>> On Oct 30, 2017, at 7:38 PM, GitBox <[email protected]> wrote: >>>>>>>> >>>>>>>> justinmclean commented on issue #60: Image not removed when src >>>>>>>>set >>>>>>>> to >>>>>>> null >>>>>>>> URL: >>>>>>>> >>>>>>>>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgi >>>>>>>>th >>>>>>>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fg >>>>>>>>ith> >>>>>>>> ub.com >>>>>>>><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fub >>>>>>>>.com%2F&data=02%7C01%7C%7C54b744f304af408f80c908d5204860d3%7Cfa7b1b >>>>>>>>5a7b34438794aed2c178decee1%7C0%7C0%7C636450417665614182&sdata=r6HO% >>>>>>>>2BnrNPHbRD50yN6YnOUnW%2FSeeVdvfqXCAVdMdg9I%3D&reserved=0>%2Fapache% >>>>>>>>2Froyale-asjs%2Fissues%2F60%23&data=02%7C01%7C%7Cd040 >>>>>>>> >>>>>>>>5ef4adc6485ba55208d51fc38b07%7Cfa7b1b5a7b34438794aed2c178decee1%7C0 >>>>>>>>%7 >>>>>>>> >>>>>>>>C0%7C636449847130199355&sdata=GJ5cQmWUXSJyuYIcs2dn5UU%2BGtWVqy17xFb >>>>>>>>if >>>>>>>> 9Gknpc%3D&reserved=0 >>>>>>> issuecomment-340524197 >>>>>>>> >>>>>>>> >>>>>>>> This code fails to compile: >>>>>>>> ``` >>>>>>>> <?xml version="1.0" encoding="utf-8"?> >>>>>>>> <js:Application >>>>>>>> >>>>>>>>xmlns:fx="https://na01.safelinks.protection.outlook.com/?url=http%3 >>>>>>>>A% <https://na01.safelinks.protection.outlook.com/?url=http%3A%> >>>>>>>> 2F%2Fns.adobe.com >>>>>>>><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2F2f >>>>>>>>ns.adobe.com%2F&data=02%7C01%7C%7C54b744f304af408f80c908d5204860d3% >>>>>>>>7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636450417665614182&sda >>>>>>>>ta=F2suvsGXXdUZIQ1ewrhxtJbX6bro5WZgQnka2EHTpLY%3D&reserved=0>%2Fmxm >>>>>>>>l%2F2009&data=02%7C01%7C%7Cd0405ef4adc6485ba55 >>>>>>>> >>>>>>>>208d51fc38b07%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63644984 >>>>>>>>71 >>>>>>>> >>>>>>>>30355609&sdata=h2%2BZE%2FtC5p0ZVuay%2B01WvZSF%2BSc7%2BUbqLFKdzAe4%2 >>>>>>>>Bn >>>>>>>> o%3D&reserved=0" >>>>>>>> xmlns:js="library://ns.apache.org/royale/basic >>>>>>>><library://ns.apache.org/royale/basic>"> >>>>>>>> >>>>>>>> <fx:Script><![CDATA[ >>>>>>>> import org.apache.flex.events.IEventDispatcher; >>>>>>>> >>>>>>>> public function blankimage():void { >>>>>>>> image.visible = false; >>>>>>>> image.src = >>>>>>>> >>>>>>>>"https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fw >>>>>>>>ww >>>>>>>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fw >>>>>>>>ww> >>>>>>>> .apache.org >>>>>>>><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fap >>>>>>>>ache.org%2F&data=02%7C01%7C%7C54b744f304af408f80c908d5204860d3%7Cfa >>>>>>>>7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636450417665614182&sdata=w >>>>>>>>CeLuvseIB90HK6j56Ba5Kb7GYd9Dh6Edb7xsBW2e3g%3D&reserved=0>%2F&data=0 >>>>>>>>2%7C01%7C%7Cd0405ef4adc6485ba55208d51fc38b07%7Cf >>>>>>>> >>>>>>>>a7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636449847130355609&sdata= >>>>>>>>pn >>>>>>>> iuBoujFMWxq1MjO1rmnLPHgMC6CzFPHl2HhXjOwhk%3D&reserved=0 >>>>> foundation/press/kit/ >>>>>>> poweredBy/Apache_PoweredBy.png"; >>>>>>>> } >>>>>>>> public function showImage():void { >>>>>>>> image.visible = true; >>>>>>>> } >>>>>>>> ]]></fx:Script> >>>>>>>> >>>>>>>> <js:valuesImpl> >>>>>>>> <js:SimpleCSSValuesImpl/> >>>>>>>> </js:valuesImpl> >>>>>>>> >>>>>>>> <js:initialView> >>>>>>>> >>>>>>>> <js:View> >>>>>>>> <js:Container id="startPage" visible="true" >>>>>>>> width="100%"> >>>>>>>> <js:beads> >>>>>>>> <js:VerticalLayout /> >>>>>>>> </js:beads> >>>>>>>> <js:Image id="image" >>>>>>>> >>>>>>>>src="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F >>>>>>>>%2 >>>>>>>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2> >>>>>>>> Fwww.apache.org >>>>>>>><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ffw >>>>>>>>ww.apache.org%2F&data=02%7C01%7C%7C54b744f304af408f80c908d5204860d3 >>>>>>>>%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636450417665614182&sd >>>>>>>>ata=HyPKXle%2FuDEe7rDKrDs7Wizd92wpdcj5bh0tw14gZDk%3D&reserved=0>%2F >>>>>>>>&data=02%7C01%7C%7Cd0405ef4adc6485ba55208d51fc38b07 >>>>>>>> >>>>>>>>%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636449847130355609&sd >>>>>>>>at >>>>>>>> a=pniuBoujFMWxq1MjO1rmnLPHgMC6CzFPHl2HhXjOwhk%3D&reserved=0 >>>>>>> foundation/press/kit/asf_logo_url.png" width="50%" height="50%" >>>>>>> layoutNeeded="showImage()" /> >>>>>>>> <js:TextButton text="Blank" click="blankimage()" /> >>>>>>>> </js:Container> >>>>>>>> </js:View> >>>>>>>> </js:initialView> >>>>>>>> >>>>>>>> </js:Application> >>>>>>>> ``` >>>>>>>> >>>>>>>> With this error: >>>>>>>> ``` >>>>>>>> >>>>>>>>/Users/justinmclean/IdeaProjects/FlexJSTest/src/ImageBlank.mxml(26) >>>>>>>>: >>>>>>> col: 130 This attribute is unexpected. It will be ignored. >>>>>>>> >>>>>>>> <js:Image id="image" >>>>>>>> >>>>>>>>src="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F >>>>>>>>%2 >>>>>>>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2> >>>>>>>> Fwww.apache.org >>>>>>>><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ffw >>>>>>>>ww.apache.org%2F&data=02%7C01%7C%7C54b744f304af408f80c908d5204860d3 >>>>>>>>%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636450417665614182&sd >>>>>>>>ata=HyPKXle%2FuDEe7rDKrDs7Wizd92wpdcj5bh0tw14gZDk%3D&reserved=0>%2F >>>>>>>>&data=02%7C01%7C%7Cd0405ef4adc6485ba55208d51fc38b07 >>>>>>>> >>>>>>>>%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636449847130355609&sd >>>>>>>>at >>>>>>>> a=pniuBoujFMWxq1MjO1rmnLPHgMC6CzFPHl2HhXjOwhk%3D&reserved=0 >>>>>>> foundation/press/kit/asf_logo_url.png" width="50%" height="50%" >>>>>>> layoutNeeded="showImage()" /> >>>>>>>> ``` >>>>>>>> >>>>>>>> I assume the only way to do this would be to add a hard coded >>>>>>>>event >>>>>>> listener manually like so? >>>>>>>> >>>>>>>> ``` >>>>>>>> <fx:Script><![CDATA[ >>>>>>>> public function blankimage():void { >>>>>>>> image.visible = false; >>>>>>>> image.src = >>>>>>>> >>>>>>>>"https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fw >>>>>>>>ww >>>>>>>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fw >>>>>>>>ww> >>>>>>>> .apache.org >>>>>>>><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fap >>>>>>>>ache.org%2F&data=02%7C01%7C%7C54b744f304af408f80c908d5204860d3%7Cfa >>>>>>>>7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636450417665614182&sdata=w >>>>>>>>CeLuvseIB90HK6j56Ba5Kb7GYd9Dh6Edb7xsBW2e3g%3D&reserved=0>%2F&data=0 >>>>>>>>2%7C01%7C%7Cd0405ef4adc6485ba55208d51fc38b07%7Cf >>>>>>>> >>>>>>>>a7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636449847130355609&sdata= >>>>>>>>pn >>>>>>>> iuBoujFMWxq1MjO1rmnLPHgMC6CzFPHl2HhXjOwhk%3D&reserved=0 >>>>> foundation/press/kit/ >>>>>>> poweredBy/Apache_PoweredBy.png"; >>>>>>>> image.addEventListener("layoutNeeded", showImage); >>>>>>>> } >>>>>>>> >>>>>>>> public function showImage(event:Event):void { >>>>>>>> image.visible = true; >>>>>>>> } >>>>>>>> ]]></fx:Script> >>>>>>>> ``` >>>>>>>> >>>>>>>> >>>>>>>> ---------------------------------------------------------------- >>>>>>>> This is an automated message from the Apache Git Service. >>>>>>>> To respond to the message, please log on GitHub and use the >>>>>>>> URL above to go to the specific comment. >>>>>>>> >>>>>>>> For queries about this service, please contact Infrastructure at: >>>>>>>> [email protected] <mailto:[email protected]> >>>>>>>> >>>>>>>> >>>>>>>> With regards, >>>>>>>> Apache Git Services >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> >>>>>> Piotr Zarzycki >>>>>> >>>>>> mobile: +48 880 859 557 >>>>>> skype: zarzycki10 >>>>>> >>>>>> LinkedIn: >>>>>> >>>>>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.l >>>>>>in >>>>>><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww. >>>>>>lin> >>>>>> kedin.com >>>>>><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fkedi >>>>>>n.com%2F&data=02%7C01%7C%7C54b744f304af408f80c908d5204860d3%7Cfa7b1b5 >>>>>>a7b34438794aed2c178decee1%7C0%7C0%7C636450417665614182&sdata=Mm3KnX%2 >>>>>>Fqw2VS9FWPISeb6Knk5ujLq3a1GkeW5w%2Fa6%2Bc%3D&reserved=0>%2Fpiotrzarzy >>>>>>cki&data=02%7C01%7C%7Cd0405ef4adc6485ba55208d51fc >>>>>> >>>>>>38b07%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636449847130355609 >>>>>>&s >>>>>> data=Mhs%2F8uCEal%2F%2ByaWFrAPHoahv3fp7MaaCQ7ezLraU5WQ%3D&reserved=0 >>>>>> >>>>>> >>>>>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpl. >>>>>>li >>>>>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpl. >>>>>>li> >>>>>> nkedin.com >>>>>><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fnked >>>>>>in.com%2F&data=02%7C01%7C%7C54b744f304af408f80c908d5204860d3%7Cfa7b1b >>>>>>5a7b34438794aed2c178decee1%7C0%7C0%7C636450417665614182&sdata=4v8CSfu >>>>>>TEXFUvstLxKrulQPrEp4XuahgnAFuQnGz00Y%3D&reserved=0>%2Fin%2Fpiotr-zarz >>>>>>ycki-92a53552&data=02%7C01%7C%7Cd0405ef4adc >>>>>> >>>>>>6485ba55208d51fc38b07%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63 >>>>>>64 >>>>>> >>>>>>49847130355609&sdata=K%2FVEqa3kVpSXeOppqc9JLQKnxRmGNI3bZNQ%2FHqEAKNo% >>>>>>3D >>>>>> &reserved=0> >>>>>> >>>>>> GitHub: >>>>>> >>>>>>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith >>>>>>ub >>>>>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit >>>>>>hub> >>>>>> >>>>>>.com%2Fpiotrzarzycki21&data=02%7C01%7C%7Cd0405ef4adc6485ba55208d51fc3 >>>>>>8b >>>>>> >>>>>>07%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636449847130355609&sd >>>>>>at >>>>>> a=mi12zf18eKrbGi30qfgZgGD9RRoPGGL%2BwAo1unRqnYc%3D&reserved=0 >>>>> >>>>> >>>> >>>> >>>> -- >>>> >>>> Piotr Zarzycki >>>> >>>> mobile: +48 880 859 557 >>>> skype: zarzycki10 >>>> >>>> LinkedIn: >>>> >>>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.lin >>>>ke >>>><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.li >>>>nke> >>>> din.com >>>><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdin.co >>>>m%2F&data=02%7C01%7C%7C54b744f304af408f80c908d5204860d3%7Cfa7b1b5a7b344 >>>>38794aed2c178decee1%7C0%7C0%7C636450417665614182&sdata=Vd1DLR0HJtY44XdR >>>>L3rfOKv0%2FISQd7AIugp2SEo0sPM%3D&reserved=0>%2Fpiotrzarzycki&data=02%7C >>>>01%7C%7Cd0405ef4adc6485ba55208d51fc38b0 >>>> >>>>7%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636449847130355609&sdata >>>>=M >>>> hs%2F8uCEal%2F%2ByaWFrAPHoahv3fp7MaaCQ7ezLraU5WQ%3D&reserved=0 >>>> >>>> >>>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpl.li >>>>nk >>>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpl.li >>>>nk> >>>> edin.com >>>><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fedin.c >>>>om%2F&data=02%7C01%7C%7C54b744f304af408f80c908d5204860d3%7Cfa7b1b5a7b34 >>>>438794aed2c178decee1%7C0%7C0%7C636450417665614182&sdata=YiselN3iLsgF8wv >>>>dfKQTmQyfQzwEExpIcvdlptHponI%3D&reserved=0>%2Fin%2Fpiotr-zarzycki-92a53 >>>>552&data=02%7C01%7C%7Cd0405ef4adc6485 >>>> >>>>ba55208d51fc38b07%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63644984 >>>>71 >>>> >>>>30355609&sdata=K%2FVEqa3kVpSXeOppqc9JLQKnxRmGNI3bZNQ%2FHqEAKNo%3D&reser >>>>ve >>>> d=0> >>>> >>>> GitHub: >>>> >>>>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub >>>>.c >>>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithu >>>>b.c> >>>> >>>>om%2Fpiotrzarzycki21&data=02%7C01%7C%7Cd0405ef4adc6485ba55208d51fc38b07 >>>>%7 >>>> >>>>Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636449847130355609&sdata=mi >>>>12 >>>> zf18eKrbGi30qfgZgGD9RRoPGGL%2BwAo1unRqnYc%3D&reserved=0 >
