flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [20/28] git commit: [flex-asjs] [refs/heads/develop] - JS version of getProperty/setProperty
Date Tue, 23 Dec 2014 07:41:43 GMT
JS version of getProperty/setProperty


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/f073481b
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/f073481b
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/f073481b

Branch: refs/heads/develop
Commit: f073481bc69524b8c84148b4a80111222d5651c8
Parents: edfda77
Author: Alex Harui <aharui@apache.org>
Authored: Mon Dec 22 10:03:06 2014 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Mon Dec 22 10:03:06 2014 -0800

----------------------------------------------------------------------
 .../org/apache/flex/events/EventDispatcher.js   | 32 ++++++++++++++++++++
 1 file changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f073481b/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js b/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js
index d6012fd..24c4ae2 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js
@@ -63,3 +63,35 @@ org.apache.flex.events.EventDispatcher.prototype.addEventListener =
 
   goog.events.listen(source, type, handler);
 };
+
+
+/**
+ * @expose
+ * @param {Object} obj The object.
+ * @param {string} propName The name of the property.
+ * @return {Object} value The value of the property.
+ */
+org.apache.flex.events.EventDispatcher.prototype.getProperty =
+    function(obj, propName) {
+  if (typeof obj['get_' + propName] === 'function') {
+    return obj['get_' + propName]();
+  }
+  return obj[propName];
+};
+
+
+/**
+ * @expose
+ * @param {Object} obj The object.
+ * @param {string} propName The name of the property.
+ * @param {Object} value The value of the property.
+ */
+org.apache.flex.events.EventDispatcher.prototype.setProperty =
+function(obj, propName, value) {
+  if (typeof obj['set_' + propName] === 'function') {
+    obj['set_' + propName](value);
+  } else {
+    obj[propName] = value;
+  }
+};
+


Mime
View raw message