flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erikdebr...@apache.org
Subject [1/2] git commit: [flex-asjs] [refs/heads/develop] - Added support for missing JS functions 'as', 'int', 'is', 'trace' and 'uint'. Having them be part of FlexJS removes the need to add them to the global namespace, preventing unnecessary pollution.
Date Fri, 01 Nov 2013 11:31:52 GMT
Updated Branches:
  refs/heads/develop 7cef6640f -> de4222b4f


Added support for missing JS functions 'as', 'int', 'is', 'trace' and 'uint'. Having them
be part of FlexJS removes the need to add them to the global namespace, preventing unnecessary
pollution.

Signed-off-by: Erik de Bruin <erik@ixsoftware.nl>


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

Branch: refs/heads/develop
Commit: 28c8ac319aa8b003ef580a0aeeab019cae4f01af
Parents: 7cef664
Author: Erik de Bruin <erik@ixsoftware.nl>
Authored: Fri Nov 1 10:00:17 2013 +0100
Committer: Erik de Bruin <erik@ixsoftware.nl>
Committed: Fri Nov 1 10:00:17 2013 +0100

----------------------------------------------------------------------
 .../src/org/apache/flex/utils/Language.js       | 102 +++++++++++++++++++
 1 file changed, 102 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/28c8ac31/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js b/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js
new file mode 100644
index 0000000..94da9ca
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js
@@ -0,0 +1,102 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*jshint globalstrict: true, indent: 2, maxlen: 80, strict: true, white: false */
+/*global goog, org */
+
+'use strict';
+
+goog.provide('org.apache.flex.utils.Language');
+
+
+
+/**
+ * @constructor
+ */
+org.apache.flex.utils.Language = function() {
+	//
+};
+
+
+/**
+ * as()
+ *
+ * @expose
+ * @param {!Object} leftOperand The lefthand operand of the
+ *     binary as operator in AS3.
+ * @param {!Object} rightOperand The righthand operand of the
+ *     binary operator in AS3.
+ * @return {?Object} Returns the lefthand operand if it is
+ *     of the type of the righthand operand, otherwise null.
+ */
+org.apache.flex.utils.Language.as = function(leftOperand, rightOperand) {
+	return (org.apache.flex.utils.Language.is(leftOperand, rightOperand)) ?
+	    leftOperand : null;
+};
+
+
+/**
+ * int()
+ *
+ * @expose
+ * @param {*} value The value to be cast.
+ * @return {number}
+ */
+org.apache.flex.utils.Language.int = function(value) {
+	return value >> 0;
+};
+
+
+/**
+ * is()
+ *
+ * @expose
+ * @param {!Object} leftOperand The lefthand operand of the
+ *     binary as operator in AS3.
+ * @param {!Object} rightOperand The righthand operand of the
+ *     binary operator in AS3.
+ * @return {boolean}
+ */
+org.apache.flex.utils.Language.is = function(leftOperand, rightOperand) {
+	return true;
+};
+
+
+/**
+ * trace()
+ *
+ * @expose
+ * @param {string} value The message to be written to the console.
+ */
+org.apache.flex.utils.Language.trace = function(value) {
+	try {
+		if (console && console.log) {
+			console.log(value);
+		}
+	} catch (e) {
+		// ignore; at least we tried ;-)
+	}
+};
+
+
+/**
+ * uint()
+ *
+ * @expose
+ * @param {*} value The value to be cast.
+ * @return {number}
+ */
+org.apache.flex.utils.Language.uint = function(value) {
+	return value >>> 0;
+};


Mime
View raw message