incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Newman <Capta...@unFocus.com>
Subject Re: [FalconJx] New JavaScript runtime format prototype
Date Thu, 20 Dec 2012 23:53:46 GMT
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.


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