JavaScript-1.5 Reference

JS_AliasProperty Function Deprecated

Summary

Deprecated. Create an alias for a native property.

Syntax

JSBool JS_AliasProperty(JSContext *cx, JSObject *obj,
    const char *name, const char *alias);
NameTypeDescription
cxJSContext *Pointer to a JS context from which to derive runtime information.
objJSObject *Object for which to create the alias.
nameconst char *Name of the property for which to create an alias.
aliasconst char *Alias name to assign to the property.

Description

JS_AliasProperty assigns an alternate name for a property associated with a native object. obj is the object to which the property belongs. name is the property's current name in the object, and alias is the alternate name to assign to the property.

Notes

This feature is deprecated, meaning that it is currently supported only for backward compatibility with existing applications. Future versions of the engine may no longer support this function.

An alias does not replace a property's name; it supplements it, providing a second way to reference a property. If the alias is successfully created and associated with the property, JS_AliasProperty returns JS_TRUE. Creating an alias does not change the length of the property array.

If the property name you specify does not exist, JS_AliasProperty reports an error, and returns JS_FALSE. If the property is currently out of scope, already exists, or the alias itself cannot be assigned to the property, JS_AliasProperty does not report an error, but returns JS_FALSE.

Once you create an alias, you can reassign it to other properties as needed. Aliases can also be deleted. Deleting an alias does not delete the property to which it refers.

See Also

Groups [ Deprecated | Function ]
Documents [ LXR ID Search ]
Entries [ JS_DefineProperty | JS_DefinePropertyWithTinyId | JS_DefineUCProperty | JS_DefineUCPropertyWithTinyID | JS_DeleteProperty | JS_GetProperty | JS_LookupProperty | JS_SetProperty ]

This page was generated by APIDOC