Class JS5Object

java.lang.Object
org.fife.rsta.ac.js.ecma.api.ecma3.JSObject
org.fife.rsta.ac.js.ecma.api.ecma5.JS5Object
All Implemented Interfaces:
JSObjectFunctions, JS5ObjectFunctions

public abstract class JS5Object extends JSObject implements JS5ObjectFunctions
Base JavaScript Object
Since:
Standard ECMA-262 3rd. Edition
  • Constructor Details

    • JS5Object

      public JS5Object()
      Object Object()

      Creates a new object instance

      Since:
      Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
    • JS5Object

      public JS5Object(JSObject value)
      Object Object(value)
      Parameters:
      value - optional argument specifies a primitive JavaScript value - a number, boolean etc..
      Since:
      Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
  • Method Details

    • create

      public static JS5Object create(JS5Object proto, JS5Object descriptors)
      function create(proto, descriptors) create an object with specified prototype and properties.

      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},
       });
       
      Parameters:
      proto - The prototype of the newly created object, or null.
      descriptors - An optional object that maps property names to property descriptors.
      Since:
      Standard ECMA-262 5th. Edition
      See Also:
    • defineProperties

      public static JS5Object defineProperties(JS5Object o, JS5Object descriptors)
      function defineProperties(o, descriptors) create or configure multiple object properties.

      Example

       var p = Object.defineProperties({}), {
         x: { value: 1, writable, false, enumerable:true. configurable:true},
         y: { value: 2, writable, false, enumerable:true. configurable:true},
       });
       
      Parameters:
      o - The object on which properties are to be created or configured.
      descriptors - An object that maps property names to property descriptors.
      Since:
      Standard ECMA-262 5th. Edition
      See Also:
    • defineProperty

      public static JS5Object defineProperty(JS5Object o, JS5String name, JS5Object desc)
      function defineProperty(o, name, desc) create or configure an object property.

      Example

       function constant(o, n, v) { //define a constant with value v
         Object.defineProperty (o, n, { value: v, writable, false, enumerable:true. configurable:true});
       }
       
      Parameters:
      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.
      Since:
      Standard ECMA-262 5th. Edition
      See Also:
    • freeze

      public static JS5Object freeze(JS5Object o)
      function freeze(o) make an object immutable.
      Parameters:
      o - The object to be frozen.
      Since:
      Standard ECMA-262 5th. Edition
      See Also:
    • getOwnPropertyDescriptor

      public static JS5Object getOwnPropertyDescriptor(JS5Object o, JS5String name)
      function getOwnPropertyDescriptor(o, name) query property attributes.
      Parameters:
      o - The object that is to have its property attributes queried.
      name - The name of the property to query.
      Since:
      Standard ECMA-262 5th. Edition
      See Also:
    • getOwnPropertyNames

      public static JS5Array getOwnPropertyNames(JS5Object o)
      function getOwnPropertyNames(o) return the names of non-inherited properties.

      Example

       Object.getOwnPropertyNames([]); //returns [length]: "length" is non enumerable
       
      Parameters:
      o - An object
      Since:
      Standard ECMA-262 5th. Edition
      See Also:
    • getPrototypeOf

      public static JS5Object getPrototypeOf(JS5Object o)
      function getPrototypeOf(o) return the prototype of an object

      Example

       var p = {}; //create object
       Object.getPrototypeOf(p); //=> Object.prototype
       var o = Object.create(p); //an object inherited from p
       Object.getPrototypeOf(o); //=> p
       
      Parameters:
      o - An object.
      Since:
      Standard ECMA-262 5th. Edition
      See Also:
    • isExtensible

      public static JSBoolean isExtensible(JS5Object o)
      function isExtensible(o) can new properties be added to an object?

      Example

       var o = {}; //create object
       Object.isExtensible(o); //=> true
       Object.preventExtensions(o); //Make it non-extensible
       Object.isExtensible(o); //=> false
       
      Parameters:
      o - The object to be checked for extensibility
      Since:
      Standard ECMA-262 5th. Edition
      See Also:
    • isFrozen

      public static JSBoolean isFrozen(JS5Object o)
      function isFrozen(o) is an object immutable?
      Parameters:
      o - The object to be checked.
      Since:
      Standard ECMA-262 5th. Edition
      See Also:
    • isSealed

      public static JSBoolean isSealed(JS5Object o)
      function isSealed(o) can properties be added or deleted from an object?
      Parameters:
      o - The object to be checked.
      Since:
      Standard ECMA-262 5th. Edition
      See Also:
    • keys

      public static JS5Array keys(JS5Object o)
      function keys(o) return enumerable property names. Example
       Object.keys({x:1, y:2}); // => ["x", "y"]
       
      Parameters:
      o - an object
      Since:
      Standard ECMA-262 5th. Edition
      See Also:
    • preventExtensions

      public static JS5Object preventExtensions(JS5Object o)
      function preventExtensions(o) don't allow new properties on an object.
      Parameters:
      o - The object is to have its extensibility attribute set.
      Since:
      Standard ECMA-262 5th. Edition
      See Also:
    • seal

      public static JS5Object seal(JS5Object o)
      function seal(o) prevent the addition or deletion of properties.
      Parameters:
      o - The object to be sealed.
      Since:
      Standard ECMA-262 5th. Edition
      See Also: