Replaced __define[GS]etter__ with defineProperty for prop proxy
parent
3651e31d20
commit
df2943b5a1
|
@ -90,18 +90,23 @@ exports.createPropProxy = function( base, dest, props )
|
|||
|
||||
( function( prop )
|
||||
{
|
||||
// just in case it's already defined, so we don't throw an error
|
||||
dest[ prop ] = undefined;
|
||||
|
||||
// public properties, when set internally, must forward to the
|
||||
// actual variable
|
||||
dest.__defineSetter__( prop, function( val )
|
||||
Object.defineProperty( dest, prop, {
|
||||
set: function( val )
|
||||
{
|
||||
base[ prop ] = val;
|
||||
} );
|
||||
},
|
||||
|
||||
// since we're defining a setter, we'll need to define a getter
|
||||
// to return the value, or we'll simply return undefined
|
||||
dest.__defineGetter__( prop, function()
|
||||
get: function()
|
||||
{
|
||||
return base[ prop ];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
} );
|
||||
} ).call( null, prop );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue