You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2020/01/04 15:55:47 UTC

[royale-asjs] branch develop updated: tour-de-jewel: remove unused themes when load next

This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 22a9116  tour-de-jewel: remove unused themes when load next
22a9116 is described below

commit 22a911615a1c912baea61fcb0b9228241570749d
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sat Jan 4 16:55:37 2020 +0100

    tour-de-jewel: remove unused themes when load next
---
 examples/royale/TourDeJewel/src/main/royale/WelcomeSection.mxml | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/examples/royale/TourDeJewel/src/main/royale/WelcomeSection.mxml b/examples/royale/TourDeJewel/src/main/royale/WelcomeSection.mxml
index ca7b77c..962430c 100644
--- a/examples/royale/TourDeJewel/src/main/royale/WelcomeSection.mxml
+++ b/examples/royale/TourDeJewel/src/main/royale/WelcomeSection.mxml
@@ -32,10 +32,17 @@ limitations under the License.
             [Bindable]
             public var color:String = "Blue";
 
+            private var themeIds:Array = [];
+
             public function changeCSS(event:Event):void
             {
                 color = event.target.selectedItem;
-                loadCSS("assets/themes/Jewel-Light-NoFlat-Primary-" + color + "-Theme/defaults.css");
+
+                // This will remove link tags by Id to avoid store unused themes
+                if(themeIds.length > 0)
+                    document.getElementById(themeIds.pop()).outerHTML = "";
+                
+                themeIds.push(loadCSS("assets/themes/Jewel-Light-NoFlat-Primary-" + color + "-Theme/defaults.css"));
             }
         ]]>
     </fx:Script>