Visit Mozilla.org

Core JavaScript 1.5 Reference:Global Objects:Object: defineGetter

From MDC


Contents

[edit] Summary

Binds an object's property to a function to be called when that property is looked up.

[edit] Syntax

obj.__defineGetter__(sprop, fun)

[edit] Parameters

sprop
a string containing the name of the property to bind to the given function
fun
a function to be bound to a lookup of the specified property

[edit] Description

The __defineGetter__ allows a getter to be defined on a pre-existing object.

[edit] See also