public abstract class JS5Object extends JSObject implements JS5ObjectFunctions
hasOwnPropertyconstructor, prototype| Constructor and Description |
|---|
JS5Object()
Object Object()
|
JS5Object(JSObject value)
Object Object(value)
|
| Modifier and Type | Method and Description |
|---|---|
static JS5Object |
create(JS5Object proto,
JS5Object descriptors)
function create(proto, descriptors) create an object with specified prototype and properties.
|
static JS5Object |
defineProperties(JS5Object o,
JS5Object descriptors)
function defineProperties(o, descriptors) create or configure multiple object properties.
|
static JS5Object |
defineProperty(JS5Object o,
JS5String name,
JS5Object desc)
function defineProperty(o, name, desc) create or configure an object property.
|
static JS5Object |
freeze(JS5Object o)
function freeze(o) make an object immutable.
|
static JS5Object |
getOwnPropertyDescriptor(JS5Object o,
JS5String name)
function getOwnPropertyDescriptor(o, name) query property attributes.
|
static JS5Array |
getOwnPropertyNames(JS5Object o)
function getOwnPropertyNames(o) return the names of non-inherited properties.
|
static JS5Object |
getPrototypeOf(JS5Object o)
function getPrototypeOf(o) return the prototype of an object
|
static JSBoolean |
isExtensible(JS5Object o)
function isExtensible(o) can new properties be added to an object?
|
static JSBoolean |
isFrozen(JS5Object o)
function isFrozen(o) is an object immutable?
|
static JSBoolean |
isSealed(JS5Object o)
function isSealed(o) can properties be added or deleted from an object?
|
static JS5Array |
keys(JS5Object o)
function keys(o) return enumerable property names.
|
static JS5Object |
preventExtensions(JS5Object o)
function preventExtensions(o) don't allow new properties on an object.
|
static JS5Object |
seal(JS5Object o)
function seal(o) prevent the addition or deletion of properties.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasOwnProperty, isPrototypeOf, propertyIsEnumerable, toLocaleString, toString, valueOfpublic JS5Object()
Creates a new object instance
public JS5Object(JSObject value)
value - optional argument specifies a primitive JavaScript value - a number, boolean etc...public static JS5Object create(JS5Object proto, JS5Object descriptors)
Example
var p = Object.create({z:0}), {
x: { value: 1, writable, false, enumerable:true. configurable:true},
y: { value: 2, writable, false, enumerable:true. configurable:true},
});
proto - The prototype of the newly created object, or null.descriptors - An optional object that maps property names to property descriptors.Object,
defineProperty(),
defineProperties(),
getOwnPropertyDescriptor()public static JS5Object defineProperties(JS5Object o, JS5Object descriptors)
Example
var p = Object.defineProperties({}), {
x: { value: 1, writable, false, enumerable:true. configurable:true},
y: { value: 2, writable, false, enumerable:true. configurable:true},
});
o - The object on which properties are to be created or configured.descriptors - An object that maps property names to property descriptors.Object,
create(),
defineProperty(),
getOwnPropertyDescriptor()public static JS5Object defineProperty(JS5Object o, JS5String name, JS5Object desc)
Example
function constant(o, n, v) { //define a constant with value v
Object.defineProperty (o, n, { value: v, writable, false, enumerable:true. configurable:true});
}
o - The object on which a property is to be created or configured.name - The name of the property created or configured.desc - A property descriptor object that describes the new property.Objectpublic static JS5Object freeze(JS5Object o)
o - The object to be frozen.Object,
defineProperty(),
isFrozen(),
preventExtensions(),
seal()public static JS5Object getOwnPropertyDescriptor(JS5Object o, JS5String name)
o - The object that is to have its property attributes queried.name - The name of the property to query.Object,
defineProperty()public static JS5Array getOwnPropertyNames(JS5Object o)
Example
Object.getOwnPropertyNames([]); //returns [length]: "length" is non enumerable
public static JS5Object getPrototypeOf(JS5Object o)
Example
var p = {}; //create object
Object.getPrototypeOf(p); //=> Object.prototype
var o = Object.create(p); //an object inherited from p
Object.getPrototypeOf(o); //=> p
public static JSBoolean isExtensible(JS5Object o)
Example
var o = {}; //create object
Object.isExtensible(o); //=> true
Object.preventExtensions(o); //Make it non-extensible
Object.isExtensible(o); //=> false
o - The object to be checked for extensibilityObjectpublic static JSBoolean isFrozen(JS5Object o)
o - The object to be checked.Object,
defineProperty(),
freeze(),
isExtensible(),
isSealed(),
preventExtensions(),
seal()public static JSBoolean isSealed(JS5Object o)
o - The object to be checked.Object,
defineProperty(),
freeze(),
isExtensible(),
isFrozen(),
preventExtensions(),
seal()public static JS5Array keys(JS5Object o)
Object.keys({x:1, y:2}); // => ["x", "y"]
o - an objectObject,
getOwnPropertyNames()public static JS5Object preventExtensions(JS5Object o)
o - The object is to have its extensibility attribute set.Object,
freeze(),
isExtensible(),
seal()public static JS5Object seal(JS5Object o)
o - The object to be sealed.Object,
defineProperty(),
freeze(),
isSealed(),
preventExtensions()