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

joshtynjala 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 5c5d94a  UIBase: move getParentEventTarget() here from EventDispatcher 
to reduce required dependencies that may not be needed in some environments
5c5d94a is described below

commit 5c5d94aa00a3073f9aeae865731575d0004d2ef0
Author: Josh Tynjala <joshtynj...@apache.org>
AuthorDate: Tue May 26 15:43:42 2020 -0700

    UIBase: move getParentEventTarget() here from EventDispatcher to reduce 
required dependencies that may not be needed in some environments
---
 .../Basic/src/main/royale/org/apache/royale/core/UIBase.as   | 12 ++++++++++++
 .../main/royale/org/apache/royale/events/EventDispatcher.as  | 12 ++----------
 .../main/royale/org/apache/royale/createjs/core/UIBase.as    | 12 ++++++++++++
 .../royale/flexUnitTests/reflection/ReflectionTesterTest.as  |  4 ++--
 4 files changed, 28 insertions(+), 12 deletions(-)

diff --git 
a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/UIBase.as 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/UIBase.as
index 063db2a..c47ce2d 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/UIBase.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/UIBase.as
@@ -38,6 +38,9 @@ package org.apache.royale.core
 
     COMPILE::JS
     {
+               import goog.events.EventTarget;
+               import org.apache.royale.core.IChild;
+        import org.apache.royale.events.EventDispatcher;
         import org.apache.royale.html.util.addElementToWrapper;
         import org.apache.royale.utils.CSSUtils;
     }
@@ -1112,6 +1115,15 @@ package org.apache.royale.core
          *  @royalesuppresspublicvarwarning
          */
                public var beads:Array;
+
+        COMPILE::JS
+               /**
+                * @royaleignorecoercion org.apache.royale.core.IChild
+                * @royaleemitcoercion org.apache.royale.events.EventDispatcher
+                */
+               override public function 
getParentEventTarget():goog.events.EventTarget{
+                       return (this as IChild).parent as EventDispatcher;
+               }
                
         
         /**
diff --git 
a/frameworks/projects/Core/src/main/royale/org/apache/royale/events/EventDispatcher.as
 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/events/EventDispatcher.as
index 10edf05..30dbd67 100644
--- 
a/frameworks/projects/Core/src/main/royale/org/apache/royale/events/EventDispatcher.as
+++ 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/events/EventDispatcher.as
@@ -20,17 +20,16 @@ package org.apache.royale.events
 {
        COMPILE::JS
        {
-    import goog.events;
+               import goog.events;
                import goog.events.Listener;
                import goog.events.EventTarget;
-    import org.apache.royale.core.IChild;
                import org.apache.royale.events.Event;
        }
 
        COMPILE::SWF
        {
                import flash.events.EventDispatcher;
-    import flash.events.IEventDispatcher;
+               import flash.events.IEventDispatcher;
        }
 
        /**
@@ -108,13 +107,6 @@ package org.apache.royale.events
 
                        return 
goog.events.EventTarget.dispatchEventInternal_(this, event1, ancestorsTree);
                }
-               /**
-                * @royaleignorecoercion org.apache.royale.core.IChild
-                * @royaleemitcoercion org.apache.royale.events.EventDispatcher
-                */
-               override public function 
getParentEventTarget():goog.events.EventTarget{
-                       return (this as IChild).parent as EventDispatcher;
-               }
                override public function fireListeners(type:Object, 
capture:Boolean, eventObject:Object):Boolean{
                        var listenerArray:Array = getListeners(type, capture);
                        if (!listenerArray) {
diff --git 
a/frameworks/projects/CreateJS/src/main/royale/org/apache/royale/createjs/core/UIBase.as
 
b/frameworks/projects/CreateJS/src/main/royale/org/apache/royale/createjs/core/UIBase.as
index 7fd39e5..6b7b2c1 100644
--- 
a/frameworks/projects/CreateJS/src/main/royale/org/apache/royale/createjs/core/UIBase.as
+++ 
b/frameworks/projects/CreateJS/src/main/royale/org/apache/royale/createjs/core/UIBase.as
@@ -42,6 +42,9 @@ package org.apache.royale.createjs.core
         import createjs.Container;
         import createjs.DisplayObject;
         import createjs.Stage;
+               import goog.events.EventTarget;
+               import org.apache.royale.core.IChild;
+        import org.apache.royale.events.EventDispatcher;
         import org.apache.royale.core.WrappedHTMLElement;
     }
        
@@ -221,6 +224,15 @@ package org.apache.royale.createjs.core
          *  @royalesuppresspublicvarwarning
                 */
                public var beads:Array;
+
+        COMPILE::JS
+               /**
+                * @royaleignorecoercion org.apache.royale.core.IChild
+                * @royaleemitcoercion org.apache.royale.events.EventDispatcher
+                */
+               override public function 
getParentEventTarget():goog.events.EventTarget{
+                       return (this as IChild).parent as EventDispatcher;
+               }
                
                /**
                 *  The method called when added to a parent.  This is a good
diff --git 
a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTest.as
 
b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTest.as
index cbf235c..3eefc5e 100644
--- 
a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTest.as
+++ 
b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTest.as
@@ -144,7 +144,7 @@ package flexUnitTests.reflection
             assertEquals( 3, variables.length, "unexpected instance variables 
length");
             
             //there is a difference based on the EventDispatcher inheritance 
chain differences between js and swf:
-            expected = isJS ? 6 : 7;
+            expected = isJS ? 5 : 7;
             var methods:Array = def.methods;
             assertEquals( expected, methods.length, "unexpected instance 
methods length");
             
@@ -177,7 +177,7 @@ package flexUnitTests.reflection
             assertEquals( 3, variables.length, "unexpected instance variables 
length");
             
             //there is a difference based on the EventDispatcher inheritance 
chain differences between js and swf:
-            expected = isJS ? 6 : 7;
+            expected = isJS ? 5 : 7;
             var methods:Array = def.methods;
             assertEquals( expected, methods.length, "unexpected instance 
methods length");
             

Reply via email to