royale-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] aharui commented on issue #341: Adding listener for when a bindable style has changed
Date Fri, 09 Nov 2018 19:53:41 GMT
aharui commented on issue #341: Adding listener for when a bindable style has changed
URL: https://github.com/apache/royale-asjs/pull/341#issuecomment-437476563
 
 
   Yes, good point that BindableCSSStyles needs a reference to its "host".  
   
   So thinking about this some more, there are two scenarios to support.  One is that someone
sets a style property at runtime via 
   
   `myUIBase.style.foo = "bar";`
   
   And one just I thought about is that there could be properties on a component that are
implemented as changes to HTMLElement.styles.  The 'visible' property is an example (more
or less).  Not sure if there are others.  I would say that properties that result in changes
to HTMLElement.styles are not required to go through BindableCSSStyles.  Instead they can
just set HTMLElement.styles directly.
   
   So, I'm not clear that BindableCSSStyles needs to listen to UIBase for style changes, but
it does need a reference to know what to pass to the IValuesImpl if we encapsulate change
handling outside of UIBase (which would be more PAYG, IMO).
   
   If I understand your alternate plan, you are suggesting a bead that integrates BindableCSSStyles
with its host.  That's reasonable, but isn't another option that BindableCSSStyles itself
could a bead?  Not sure if we have other beads assigned via properties.  The styles setter
would test if the object is IBead and if so, would put BindableCSSStyles on the strand.  That
test is still just-in-case code, but it might be ok.  We could get rid of that test by requiring
that if folks use BindableCSSStyles that they use it on the beads list and not as the styles
object, but that seems too weird.  Or maybe all objects assigned to styles must be a Bead
(or a String).
   
   Yet another option could be that the styles setter tests for an interface and assigns the
reference.  There is already an IDocument interface, but just having a host reference is more
like IStrand so maybe having BindableCSSStyles be a bead is better and avoids people forgetting
to add the bead that ties BindableCSSStyles to the change handling code.
   
   Ideally, we would remove stylesChangeHandler from UIBase and put it in BindableCSSStyles
and folks could use BindableCSSStyles without any extra beads and everything would just work
without too much other just-in-case code.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message