Object.defineProperty(o, n, { get: function() { this[n] = {}; } }) this works in Firefox, and not in Chrome...
@csuwildcat i forgot the `return this[n] = {}`. I'm hoping the property will be set to a plain object, but I don't know which acts correctly
-
-
@csuwildcat specifically, I'm defining a getter on a prototype, to hopefully lazy-create an object on an instance when/if it's needed. -
@seanmonstar so inside your getter, do a create of a new object and stick it on the instance by redefining the proto via 'value'. - 8 more replies
New conversation -
-
-
@seanmonstar so when the get is called you want it to set and hold a new object? If so, you need to hold an outside ref to a new object. -
@csuwildcat code you can execute and see what I mean: https://gist.github.com/seanmonstar/1f35fe3b0108f750afde …
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.