You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Harbs <ha...@gmail.com> on 2017/04/30 08:21:57 UTC

[FlexJS] Object.setObjectIsEnumerable()

As far as I can tell, there’s not platform agnostic way to create properties in objects which are not enumerable. In Flash you’d use setObjectIsEnumerable() and in JS, you’d use Object.defineProperty().

Using setObjectIsEnumerable() in AS3 code and cross-compiling keeps the call as-is and generates a runtime error.

There seem to be two ways to resolve this problem that I can think of:
1. Falcon can rewrite any setObjectIsEnumerable() calls to use Object.defineProperty() on the JS side.
2. We can add a Util class to add non-enumerable properties which has conditional compilation.

#1 should be more efficient at runtime, but is probably more work to implement.

Thoughts?

Harbs

Re: [FlexJS] Object.setObjectIsEnumerable()

Posted by Harbs <ha...@gmail.com>.
On second thought, the Flash and JS implementations is not 1 to 1. The assignment in Flash is a two-step rpocess of first assigning the value and then defining it as non-enumerable, while it happens all in a single call in JS.

The Util call is probably the better solution.

> On Apr 30, 2017, at 11:21 AM, Harbs <ha...@gmail.com> wrote:
> 
> As far as I can tell, there’s not platform agnostic way to create properties in objects which are not enumerable. In Flash you’d use setObjectIsEnumerable() and in JS, you’d use Object.defineProperty().
> 
> Using setObjectIsEnumerable() in AS3 code and cross-compiling keeps the call as-is and generates a runtime error.
> 
> There seem to be two ways to resolve this problem that I can think of:
> 1. Falcon can rewrite any setObjectIsEnumerable() calls to use Object.defineProperty() on the JS side.
> 2. We can add a Util class to add non-enumerable properties which has conditional compilation.
> 
> #1 should be more efficient at runtime, but is probably more work to implement.
> 
> Thoughts?
> 
> Harbs