JavaScript-1.5 Reference

JS_AliasElement Function Deprecated

Summary

Deprecated. Create an aliased index entry for an existing element or numeric property of a native object.

Syntax

JSBool JS_AliasElement(JSContext *cx, JSObject *obj,
    const char *name, jsint 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 element for which to create an alias. This name corresponds to a string representation of the element's current index number.
aliasjsintAlias number to assign to the element.

Description

JS_AliasElement assigns an alternate index number for an element or numeric property associated with a native object. obj is the object to which the element belongs. name is the element's current index in the object, and alias is the alternate index to assign to the element.

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 an element's current index number; it supplements it, providing a second way to reference the element. If the alias is successfully created and associated with the property, JS_AliasElement returns JS_TRUE. Adding an alias element does not change the element array length.

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

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

See Also

Groups [ Deprecated | Function ]
Documents [ LXR ID Search ]
Entries [ JS_DefineElement | JS_DeleteElement | JS_GetArrayLength | JS_GetElement | JS_IsArrayObject | JS_LookupElement | JS_NewArrayObject | JS_SetArrayLength | JS_SetElement ]

This page was generated by APIDOC