37 lines
711 B
Plaintext
37 lines
711 B
Plaintext
|
|
{{alias}}( obj, prop, getter, setter )
|
|
Defines a configurable property having read-write accessors.
|
|
|
|
Configurable read-write accessors are enumerable.
|
|
|
|
Parameters
|
|
----------
|
|
obj: Object
|
|
Object on which to define the property.
|
|
|
|
prop: string|symbol
|
|
Property name.
|
|
|
|
getter: Function
|
|
Get accessor.
|
|
|
|
setter: Function
|
|
Set accessor.
|
|
|
|
Examples
|
|
--------
|
|
> var obj = {};
|
|
> var name = 'bar';
|
|
> function getter() { return name + ' foo'; };
|
|
> function setter( v ) { name = v; };
|
|
> {{alias}}( obj, 'foo', getter, setter );
|
|
> obj.foo
|
|
'bar foo'
|
|
> obj.foo = 'beep';
|
|
> obj.foo
|
|
'beep foo'
|
|
|
|
See Also
|
|
--------
|
|
|