You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2022/03/13 04:53:37 UTC

[royale-asjs] branch develop updated: switching the cloning sanity-check in dispatchEvent to use Language.is in JS EventDispatcher (support prevent-rename=false on cloneEvent method)

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

gregdove 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 b376586  switching the cloning sanity-check in dispatchEvent to use Language.is in JS EventDispatcher (support prevent-rename=false on cloneEvent method)
b376586 is described below

commit b3765862542da5924d48ff552f22e3891cc628a4
Author: greg-dove <gr...@gmail.com>
AuthorDate: Sun Mar 13 17:52:06 2022 +1300

    switching the cloning sanity-check in dispatchEvent to use Language.is in JS EventDispatcher (support prevent-rename=false on cloneEvent method)
---
 .../org/apache/royale/events/EventDispatcher.as     | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

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 d3b9bca..3a19f12 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
@@ -58,6 +58,16 @@ package org.apache.royale.events
 		}
 	}
 
+	/**
+	 * This class extends goog.events.EventTarget to emulate the
+	 * flash.events.EventDispatcher functionality.
+	 *
+	 * @langversion 3.0
+	 * @playerversion Flash 10.2
+	 * @playerversion AIR 2.6
+	 * @productversion Royale 0.0
+	 *
+	 */
 	COMPILE::JS
 	public class EventDispatcher extends goog.events.EventTarget implements IEventDispatcher
 	{
@@ -72,7 +82,11 @@ package org.apache.royale.events
         {
             return goog.events.hasListener(this, type);
         }
-		
+
+		/**
+		 *
+		 * @royaleignorecoercion org.apache.royale.events.IRoyaleEvent
+		 */
 		override public function dispatchEvent(event1:Object):Boolean
 		{
 			//we get quite a few string events here, "initialize" etc
@@ -85,11 +99,10 @@ package org.apache.royale.events
 					//console.log("created event from string ",event);
 				}
 				else if ("target" in event1) {
-					if (event1.target && 'cloneEvent' in event1) {
+					if (event1.target && event1 is IRoyaleEvent) {
 						//we are re-dispatching, we need to clone the original:
-						event1 = event1.cloneEvent();
+						event1 = IRoyaleEvent(event1).cloneEvent();
 					}
-
 					event1.target = _dispatcher;
 					//console.log("assigned target to event ",event);
 				}