Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
Legend for Javascript column color usage:

Black: JavaScript matches ActionScript

{color:#ff0000}Red{color}: solution not agreed upon

{color:#3366ff}Blue{color}: solution looks good, need consencus to approve (use Comments or Notes column)

{color:#339966}Green{color}: solution agreed upon
|| || Test Available In FlexJS (+/-)? || ActionScript || JavaScript + Closure annotation || Notes ||
| *Global Constants* | | | | |
| Infinity | \- | Infinity \\ | {color:#000000}Infinity{color} \\ | |
| \-Infinity | \- | \-Infinity \\ | {color:#000000}\-Infinity{color} \\ | |
| NaN | \- | NaN | NaN \\ | |
| undefined | \- | undefined | undefined \\ | |
| | | | | |
| *Global Functions* | | | | |
| Array() \\ | \- | Array(...values) | {color:#000000}Array(...values){color}\\ | Frank's comment: [https://cwiki.apache.org/confluence/display/FLEX/AS+to+JS+translation+table?focusedCommentId=30744800#comment-30744800] |
| Boolean() | \- | Boolean(value) \\ | {color:#000000}Boolean(value){color}\\ | See "Array" function note. |
| decodeURI() | \- | decodeURI(value) | decodeURI(value) \\ | |
| decodeURIComponent() | \- | decodeURIComponent(value) \\ | decodeURIComponent(value) \\ | |
| encodeURI() \\ | \- | encodeURI(value) \\ | encodeURI(value) \\ | |
| encodeURIComponent() \\ | \- | encodeURIComponent(value) \\ | encodeURIComponent(value) \\ | |
| escape() | \- | escape(value) | escape(value) | |
| int() | \- | int(value) | {color:#339966#000000}int(value >> 0){color}\\ |  | [See "diff" page...|FLEX:Global Functions (diff)] |
| isFinite() | \- | isFinite(value) | isFinite(value) | |
| isNaN() | \- | isNaN(value) | isNaN(value) | |
| isXMLName() | \- | isXMLName(value) \\ | {color:#ff0000}?{color} | There is no matching implementation in JavaScript. We may need to build a utility function to cover this one. #000000}[See "E4X" page...|FLEX:E4X Missing in JS]{color} | |
| Number() | \- | Number(value) | {color:#000000}Number(value){color} | See "Array" function note. |
| Object() | \- | Object(value) | {color:#000000}Object(value){color}\\ | |
| parseFloat() In| ActionScript,\- calling| 'ObjectparseFloat(value)' returns| 'value' (since all values are objects). Given that, does it make sense to just write 'value' in JavaScript and let the Closure Compiler "cast" it? |
| parseFloat() | \- | parseFloat(value) | parseFloat(value) | |parseFloat(value) | |
| parseInt() | \- | parseInt(value, \[radix\]) \\ | parseInt(value, \[radix\]) \\ | |
| String() | \- | String(value) | {color:#000000}String(value){color} | See "Array" function note. |
| trace(|
| trace() | \- | trace(...values) | {color:#ff0000}console.logtrace(...values){color} | We may need a utility function to wrap 'console.log', as not all browsers have debugging enable, and calling to a non-existent 'console' object will cause an error. Maybe something like Jangaroo's 'trace' implementation? [See "diff" page...|FLEX:Global Functions (diff)]\\ |
| uint() | | uint(value) | uint(value) | {color:#339966}(value >>> 0){color} || [See "diff" page...|FLEX:Global Functions (diff)]\\ |
| unescape() | \- | unescape(value) \\ | unescape(value) \\ | |
| Vector() | \- | result = Vector.<type>(valueArray); | {color:#ff0000}result = /*\* @type \{Array.<type>\} \*/&nbsp;valueArray;{color} | Let the Closure Compiler handle (check) what is basically a type cast from general Array to a Typed Array. = Vector.<type>(valueArray); | [See "diff" page...|FLEX:Global Functions (diff)]\\ | |
| XML() \\ | \- | XML(value) | {color:#ff0000}?{color} | Use 'goog.dom.xml'?[See "E4X" page...|FLEX:E4X Missing in JS]\\ | |
| XMLList() | | XMLList(value) | {color:#ff0000}?{color}) | Use 'goog.dom.xml'? [See "E4X" page...|FLEX:E4X Missing in JS]\\ | \\ |
| | | | | |
| *Classes* \\ | | | | |
| ArgumentError | \- | ArgumentError | {color:#ff0000}Error{color}\\ | Need utility class and cast a regular error object to that, for the sake of the Closure Compiler? |
| arguments | \- | arguments | arguments | |
| Array | \- | Array | {color:#3366ff}Array{color} | Not sure if all properties and methods of AS Array class map to the JS Array class. |
| Boolean | | Boolean | {color:#000000}Boolean{color}\\ | |
| Class | \- | {code:ActionScript}
package com.example.components
{
public class MyClass
{
    public function MyClass() {}
}
}

{code} | {code:Javascript}
goog.provide('com.example.components.MyClass');

/**
 * @constructor
 */
com.example.components.MyClass = function() {};


{code} | |
| Date | \- | Date | {color:#ff0000}Date{color} | The JS class seems to be missing all the properties that the AS class offers. The methods on both classes match, AFAICT. |
| DefinitionError | \- | DefinitionError | {color:#ff0000}Error{color} | Need utility class and cast a regular Error object to that, for the sake of the Closure Compiler? \\ |
| Error | \- | Error | {color:#ff0000}Error{color} | There is no 'errorID' property on the JS Error class |
| EvalError | \- | EvalError | {color:#3366ff}EvalError{color} | Not sure if all JS VM implementations support this... \\ |
| Function | \- | Function | Function | |
| int | \- | int | {color:#3366ff}Number{color} | |
| JSON | \- | JSON | {color:#3366ff}JSON{color} | How about support for "older" browsers? Do we provide "if not JSON, add custom JSON to window object"? |
| Math | \- | Math | Math | |
| Namespace | \- | Namespace | {color:#ff0000}?{color} | Do we need a utility class? |
| Number | \- | Number | Number | |
| Object | \- | Object | Object | "setPropertyIsEnumerable" not available on JS Object.prototype... |
| QName | \- | QName | {color:#ff0000}?{color} [See "E4X" page...|FLEX:E4X Missing in JS]\\ | Part of the&nbsp;E4X implementation in AS... No such beast in JS, so maybe we look at "goog" or even a native utility class? |
| RangeError | \- | RangeError | {color:#3366ff}RangeError{color} | Not sure if all JS VM implementations support this... \\ |
| ReferenceError | \- | ReferenceError \\ | {color:#3366ff}ReferenceError{color}\\ | Not sure if all JS VM implementations support this... \\ |
| RegExp | \- | RegExp | {color:#3366ff}RegExp{color} | Does the regular expression "syntax" of both implementations match? |
| SecurityError | \- | SecurityError \\ | {color:#ff0000}Error{color}\\ | Need utility class and cast a regular Error object to that, for the sake of the Closure Compiler? \\ |
| String | \- | String | {color:#ff0000}String{color} | Not sure if all properties and methods of AS String class map to the JS String class. \\ |
| SyntaxError | \- | SyntaxError \\ | {color:#3366ff}SyntaxError{color}\\ | Not sure if all JS VM implementations support this... \\ |
| TypeError | \- | TypeError \\ | {color:#3366ff}TypeError{color}\\ | Not sure if all JS VM implementations support this... \\ |
| uint | \- | uint | {color:#ff0000}Number{color} | Does the Number object provide all "functionality" of an AS uint? If so, we're good, I think... |
| URIError | \- | URIError | {color:#3366ff}URIError{color} | Not sure if all JS VM implementations support this... |
| Vector | \- | Vector | {color:#3366ff}/*\* @type \{Array.<type>\} \*/ Array{color}\\ | Since a Vector is "nothing more" than a typed Array, we can use Closure annotation to 'force' the Closure Compiler to treat it as such. |
| VerifyError | \- | VerifyError | {color:#ff0000}Error{color}\\ | Need utility class and cast a regular Error object to that, for the sake of the Closure Compiler? |
| XML | \- | XML | {color:#ff0000}?{color} [See "E4X" page...|FLEX:E4X Missing in JS]\\ | Part of the&nbsp;E4X implementation in AS... No such beast in JS, so maybe we look at "goog" or even a native utility class? |
| XMLList | \- | XMLList | {color:#ff0000}?{color} [See "E4X" page...|FLEX:E4X Missing in JS]\\ | Part of the&nbsp;E4X implementation in AS... No such beast in JS, so maybe we look at "goog" or even a native utility class? \\ |
| | | | | |
| *Arithmetic* | | | | |
| + | \- | + | + | |
| \-\- | \- | \-\- | \-\- | |
| / | \- | / | / | |
| \+\+ | \- | \+\+ | \+\+ | |
| % | \- | % | % | |
| \* | \- | \* | \* | |
| \- | \- | \- | \- | |
| | | | | |
| *Arithmetic compound assignment* | | | | |
| \+= | \- | \+= | \+= | |
| /= | \- | /= | /= | |
| %= | \- | %= | %= | |
| \*= | \- | \*= | \*= | |
| \-= | \- | \-= | \-= | |
| | | | | |
| *Assignment* | | | | |
| = | \- | = | = | |
| | | | | |
| *Bitwise* | | | | |
| & | \- | & \\ | & | |
| << | \- \\ | << | << | |
| ~ | \- \\ | ~ \\ | ~ | |
| \| | \- \\ | \| | \| | |
| >> | \- \\ | >> | >> | |
| >>> | \- \\ | >>> | >>> | |
| ^ | \- \\ | ^ | ^ | |
| | | | | |
| *Bitwise compound assignment* | | | | |
| &= | \- | &= | &= | |
| <<= | \- | <<= | <<= | |
| \|= | \- | \|= | \|= | |
| >>= | \- | >>= | >>= | |
| >>>= | \- | >>>= | >>>= | |
| \^= | \- | \^= | \^= | |
| | | | | |
| *Comment* | | | | |
| /*\*\**/ | \- | /*\*\**/ | /*\*\**/ | |
| // | \- | // | // | |
| | | | | |
| *Comparison* | | | | |
| == | \- | == | == | |
| > | \- | > | > | |
| >= | \- | >= | >= | |
| \!= \\ | \- | \!= | \!= \\ | |
| < | \- | < | < | |
| <= | \- | <= | <= | |
| === | \- | === | === | |
| \!== \\ | \- | \!== | \!== | |
| | | | | |
| *Logical* | | | | |
| && | \- | && | && | |
| &&= | \- | x &&= y | {color:#339966}x = x && y{color}\\ | Excellent suggestion from Fank: Keep It Simple, Stupid \;-) |
| \! \\ | \- | \! | \! | |
| \|\| | \- | \|\| | \|\| | |
| \|\|= | \- | x \|\|= y | {color:#339966}x = x \|\| y{color} | KISS, again. |
| | | | | |
| *Other* | | | | |
| \[\] \\ | \- | \[\] | \[\] | |
| as | \- | as | {color:#ff0000}?{color} | I think we need a utility function |
| , | \- | , | , | |
| ?: | \- | (value) ? true : false; | (value) ? true : false; \\ | |
| delete | \- | delete | delete | |
| . | \- | . | . | |
| in | \- | in | in | |
| instanceof | \- | instanceof | {color:#ff0000}instanceof{color} | We need to check the "goog" way of inheritance for correctness of the JS 'instanceof' and see if the Closure annotation method for implementing "Interfaces" covers the functionality of AS 'instanceof'. \\ |
| is | \- | is | {color:#ff0000}?{color} | I think we need a utility function \\ |
| :: | \- | :: | {color:#ff0000}?{color} | |
| new | \- | new | new | |
| {} \\ | \- | {} | {} | |
| () | \- | () | () | |
| / | \- | / | / | Is the regular expression syntax the same between the two (AS and JS) implementations? |
| : | \- | : | multiple solutions, context dependent | To "strongly" type JS, we use the Google Closure annotations. These are JSDoc block that go with function or variable declarations and give the Closure Compiler hints as to the type of variables, arguments and return values. |
| typeof | \- | typeof | typeof | Only the "xml" type is not supported on the JS side (nor are the data types that go with it, XML and XMLList) |
| void | \- | void | void | Note: this applies to 'void' as an operator, not the "data type" |
| | | | | |
| *String* | | | | |
| + | \- | + | + | |
| \+= | \- | \+= | \+= | |
| " | \- | " | " | |
| | | | | |
| *XML* | | | | |
| @ | \- | @ | {color:#ff0000}?{color} | Part of the&nbsp;E4X implementation in AS... No such beast in JS, so maybe we look at "goog" or even a native utility class?[See "E4X" page...|FLEX:E4X Missing in JS]\\ | \\ |
| {} \\ | \- | {} | {color:#ff0000}?{color}\\ | See '@' above, and: these are [See "E4X" page...|FLEX:E4X Missing in JS]\\ | This is the same as used in AS object literals, {color:#ff0000}Mike: can you make the&nbsp;distinction?{color} |
| \[\] \\ | \- | \[\] | {color:#ff0000}?{color} | See '@' above, and: these are the [See "E4X" page...|FLEX:E4X Missing in JS]\\ | This isthe same as used in AS array literals,&nbsp;{color:#000000}Mike: can you make the&nbsp;distinction?{color} |
| + | \- | + | {color:#ff0000}?{color} | See '@' above, and: this is the  [See "E4X" page...|FLEX:E4X Missing in JS]\\ | This isthe same as used the AS concatenation operator:&nbsp;{color:#000000}Mike, can you make the{color} {color:#000000}distinction{color}{color:#000000}?{color}\\ |
| \+= | \- | \+= | {color:#ff0000}?{color} | See '@' above, and: this is the[See "E4X" page...|FLEX:E4X Missing in JS]\\ | This isthe same as used the AS concatenation operator:&nbsp;{color:#000000}Mike, can you make the destinction?{color}\\ |
| delete | \- | delete | {color:#ff0000}?{color} | See '@' above, and: this is  delete | [See "E4X" page...|FLEX:E4X Missing in JS]\\ | This is&nbsp;the same as used the AS delete operator:&nbsp;{color:#000000}Mike, can you make the{color} {color:#000000}distinction{color}{color:#000000}?{color}\\ |
| .. | \- | .. | {color:#ff0000}?{color} | Part of the&nbsp;E4X implementation in AS... No such beast in JS, so maybe we look at "goog" or even a native utility class? | \- | .. | [See "E4X" page...|FLEX:E4X Missing in JS]\\ | \\ |
| . | \- | . | {color:#ff0000}?{color}\\ | See '@' above, and: this[See "E4X" page...|FLEX:E4X Missing in JS]\\ | This is the same as used the AS access operator:&nbsp;{color:#000000}Mike, can you make the{color} {color:#000000}distinction{color}{color:#000000}?{color}\\ |
| () | \- | () | {color:#ff0000}?{color} | [See '@' above, and: this "E4X" page...|FLEX:E4X Missing in JS]\\ | This is the same as used the AS grouping operator:&nbsp;{color:#000000}Mike, can you make the destinction?{color}\\ |
| <> | \- | <> | {color:#ff0000}?{color} | Part of the&nbsp;E4X implementation in AS... No such beast in JS, so maybe we look at "goog" or even a native utility class?[See "E4X" page...|FLEX:E4X Missing in JS]\\ | |
| | | | | |
| *Statements* | | | | |
| break | \- | break | break | |
| case | \- | case | case | |
| continue | \- | continue | continue | |
| default | \- | default | default | |
| do...while | \- | do...while | do...while | |
| else | \- | else | else | |
| for | \- | for | for | |
| for...in | \- | for...in | for...in | |
| for each...in | \- | for each...in | {color:#ff0000}?{color} | We need the compiler to rework the AS loop a bit... (See comment from Frank:&nbsp;[https://cwiki.apache.org/confluence/display/FLEX/AS+to+JS+translation+table?focusedCommentId=30745636#comment-30745636]). |
| if | \- | if | if | |
| label | \- | label | label | |
| return | \- | return | return | |
| super | \- | super({color:#000000}\[arg1, ..., argN\]{color}); \\
super.method({color:#000000}\[arg1, ..., argN\]);{color} | goog.base(this, {color:#000000}\[arg1, ..., argN\]{color}); \\
goog.base(this, "method",&nbsp;{color:#000000}\[arg1, ..., argN\]{color}); \\ | |
| switch | \- | switch | switch | |
| throw | \- | throw | throw | |
| try...catch...finally | \- | try...catch...finally | try...catch...finally | |
| while | \- | while | while | |
| with | \- | with | with | |
| | | | | |
| *Attribute Keywords* | | | | |
| dynamic | \- | dynamic | {color:#3366ff}no annotation needed{color} | All JS 'classes' are dynamic by nature, so there's no need for this keyword? |
| final | \- | final | {color:#3366ff}no annotation needed{color}\\ | Is this a runtime attribute, or is it handled at compile time? If the latter, we can just leave it out as attempts to subclass this type are handled (blocked) on the AS side anyway? |
| internal | \- | internal | {color:#3366ff}no annotation needed{color} | Same as with 'final'? |
| native | \- | {color:#000000}\[not user accessible\]{color} | {color:#000000}no annotation needed&nbsp;{color} | |
| override | \- | override function myFunction() | /*\* \\
&nbsp;\* @override \\
&nbsp;*/ \\
function myFunction() | |
| private | \- | private | /*\* \\
&nbsp;\* @private \\
&nbsp;*/ | |
| protected | \- | protected | /*\* \\
&nbsp;\* @protected \\
&nbsp;*/ \\ | |
| public | \- | public | {color:#3366ff}no annotation needed{color} | All JS entities are public by nature, so there's no need for this keyword? \\ |
| static | \- | static | {color:#ff0000}?check "diff" page{color}\\ | |
| | | | | |
| *Definition keywords* | | | | |
| ... (rest) parameter | \- | ...rest | \[leave out\] | All JS functions allow an arbitrary number of arguments, so there's no need for this keyword? \\ |
| class | \- | class | function | Please see "Class" in the Class section, above. |
| const | \- | const | /*\* \\
&nbsp;\* @protected \\
&nbsp;*/ | |
| extends | \- | extends MyBaseClass | /*\* \\
&nbsp;\* @extends&nbsp;{MyBaseClass}\\
&nbsp;*/ | |
| function | \- | function | function | |
| get | \- | get | {color:#ff0000}?{color} | |
| implements | \- | implements MyInterface | /*\* \\
&nbsp;\* @extends \{MyInterface\}&nbsp; \\
&nbsp;*/ | |
| interface | \- | interface | /*\* \\
&nbsp;\* @interface \\
&nbsp;*/ | |
| namespace | \- | namespace | {color:#ff0000}?{color}\\ | |
| package | \- | package my.package | goog.provides("my.package.MyClass") | |
| set | \- | set | {color:#ff0000}?{color} | |
| var | \- | var | var | |
| | | | | |
| *Directives* | | | | |
| default xml namespace | \- | default xml namespace | {color:#ff0000}?{color} | Part of the&nbsp;E4X implementation in AS... No such beast in JS, so maybe we look at "goog" or even a native utility class?[See "E4X" page...|FLEX:E4X Missing in JS]\\ | |
| import | \- | import my.package.MyOtherClass | goog.requires("my.package.MyOtherClass"); | |
| include | \- | include | {color:#ff0000}?{color} | |
| use namespace | \- | use namespace | {color:#ff0000}?{color}\\ | |
| | | | | |
| *Namespaces* | | | | |
| AS3 | \- | ? | {color:#ff0000}?{color} | I'm not familiar with this in AS, so can't figure out what, if anything, might 'replace' this in JS. |
| flash_proxy | \- | ? | {color:#ff0000}?{color} | I'm not familiar with this in AS, so can't figure out what, if anything, might 'replace' this in JS. |
| object_proxy | \- | ? | {color:#ff0000}?{color} | I'm not familiar with this in AS, so can't figure out what, if anything, might 'replace' this in JS. |
| | | | | |
| *Primary expression keywords* | | | | |
| false | \- | false | false | |
| null | \- | null | null | |
| this | \- | this | Any method in which "this" is referenced should have the following in it's JSDoc block \\
/*\* \\
&nbsp;\* @this \{TypOfClassToWhichMethodBelongs\} &nbsp;*/ \\
this | |
| true | \- | true | true | |
| | | | | |