incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Wienberg <fr...@jangaroo.net>
Subject Re: [FalconJx] New JavaScript runtime format prototype
Date Fri, 21 Dec 2012 00:21:10 GMT
On Fri, Dec 21, 2012 at 12:53 AM, Kevin Newman <CaptainN@unfocus.com> wrote:

> I wonder if you could use the second argument of Object.create to reduce
> the number of times Object.defineProperties appears in the source (and if
> it would matter at all).
>
> // Example where we create an object with a couple of sample properties.
> // (Note that the second parameter maps keys to *property descriptors*.)
> o = Object.create(Object.**prototype, {
>   // foo is a regular "value property"
>   foo: { writable:true, configurable:true, value: "hello" },
>   // bar is a getter-and-setter (accessor) property
>   bar: {
>     configurable: false,
>     get: function() { return 10 },
>     set: function(value) { console.log("Setting `o.bar` to", value) }
> }})
>
>
> Kevin N.
>
>
Yes, completely forgot about that.
May really make the defineClass() code even more concise--I'll have a go on
this.
I'd wouldn't expect a performance impact, though. As mentioned before,
property structure set-up is only done only once for each class.

-Frank-

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message