You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2019/03/06 16:35:06 UTC

[royale-asjs] branch develop updated: Reflection: getDefinitionByName() uses goog.global instead of window because it will work in Node.js too

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 ece8fdd  Reflection: getDefinitionByName() uses goog.global instead of window because it will work in Node.js too
ece8fdd is described below

commit ece8fddb1139d40762a7b0438f92f3694bc02456
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Wed Mar 6 08:35:01 2019 -0800

    Reflection: getDefinitionByName() uses goog.global instead of window because it will work in Node.js too
---
 .../royale/org/apache/royale/reflection/getDefinitionByName.as     | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/getDefinitionByName.as b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/getDefinitionByName.as
index 821bba4..c8d6e49 100755
--- a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/getDefinitionByName.as
+++ b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/getDefinitionByName.as
@@ -22,6 +22,10 @@ COMPILE::SWF
 {
     import flash.utils.getDefinitionByName;
 }
+COMPILE::JS
+{
+    import goog.global;
+}
     
     /**
      *  The equivalent of flash.utils.getQualifiedClassName.
@@ -41,7 +45,8 @@ COMPILE::SWF
         {
             var parts:Array = name.split('.');
             var n:int = parts.length;
-            var o:Object = window;
+            //use goog.global instead of window to support node too
+            var o:Object = goog.global;
             for (var i:int = 0; i < n; i++) {
                 o = o[parts[i]];
             }