This is an automated email from the ASF dual-hosted git repository.
harbs 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 3734839 Implement propertyNames() in ObjectProxy for JS to allow
enumerations using "for" and "for each", and adjust Proxy version of
propertyNames() in JS.
new 5576954 Merge pull request #1010 from estanglerbm/objectproxy-enum
3734839 is described below
commit 3734839045701f984efe2963445e27e90c9b8df7
Author: Edward Stangler <[email protected]>
AuthorDate: Wed Dec 16 11:31:11 2020 -0600
Implement propertyNames() in ObjectProxy for JS to allow enumerations using
"for" and "for each", and adjust Proxy version of propertyNames() in JS.
---
.../Core/src/main/royale/org/apache/royale/utils/Proxy.as | 11 ++++++-----
.../projects/MXRoyale/src/main/royale/mx/utils/ObjectProxy.as | 10 ++++++++++
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git
a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/Proxy.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/Proxy.as
index ed5e48b..4c45fc5 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/Proxy.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/Proxy.as
@@ -145,12 +145,13 @@ public dynamic class Proxy extends EventDispatcher
return delete valueMap[propName];
}
- public function propertyNames():Array
+ public function propertyNames():Object
{
- var names:Array = [];
- for (var p:String in valueMap)
- names.push(p);
- return names;
+// var names:Array = [];
+// for (var p:String in valueMap)
+// names.push(p);
+// return names;
+ return valueMap;
}
}
diff --git
a/frameworks/projects/MXRoyale/src/main/royale/mx/utils/ObjectProxy.as
b/frameworks/projects/MXRoyale/src/main/royale/mx/utils/ObjectProxy.as
index 63825ca..ed7f99b 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/utils/ObjectProxy.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/utils/ObjectProxy.as
@@ -657,6 +657,16 @@ public dynamic class ObjectProxy extends Proxy
}
}
+ /*
+ * To enumerate keys: for (key:String in objproxy)
+ * To enumerate values: for each (value in objproxy)
+ */
+ COMPILE::JS
+ override public function propertyNames():Object
+ {
+ return _item;
+ }
+
//--------------------------------------------------------------------------
//
// object_proxy methods