Class Obj
Utility for objects
Defined in: object.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Obj()
|
Field Attributes | Field Name and Description |
---|---|
<static> |
Obj.getPrototype
Returns the prototype of an object, or null if the function fails to do so.
|
<static> |
Obj.XW_instanceof
Cross Window instanceof
|
Method Attributes | Method Name and Description |
---|---|
<static> |
Obj.descend(protototypeParent, childProperties)
Creates a new instance inheriting from a parent "class".
|
<static> |
Obj.extend(parentObject)
Clones and extend the object (first parameters) with other objects (following parameters).
|
<static> |
Obj.getRandomInt(min, max)
Returns a random integer between min and max
|
<static> |
Obj.getUniqueId()
Returns a unique ID (random integer between 0 and 65536)
|
<static> |
Obj.hasProperties(ob, nonEnumProps, ownPropsOnly)
Returns true if the passed object has any properties, otherwise returns false.
|
<static> |
Obj.isNonNativeGetter(obj, propName)
Tells if the given property of the provided object is a non-native getter or not.
|
Field Detail
<static>
Obj.getPrototype
Returns the prototype of an object, or null if the function fails to do so.
- Deprecated:
-
use
myObj.prototype
instead (plus clever checks before)
<static>
{Boolean}
Obj.XW_instanceof
Cross Window instanceof
- Deprecated:
-
use
instanceof
instead
Method Detail
<static>
{Object}
Obj.descend(protototypeParent, childProperties)
Creates a new instance inheriting from a parent "class".
That class is then extended with child properties.
- Parameters:
- {Object} protototypeParent
- The parent "class" prototype
- {Object} childProperties
- The properties extending the new object
- Returns:
- {Object} the new object
<static>
Obj.extend(parentObject)
Clones and extend the object (first parameters) with other objects (following parameters).
var parentObj = {foo: "foo" }; var newObj = Obj.extend(parentObj, {bar: "bar"}); // => {foo: "foo", bar: "bar"}
- Parameters:
- {Object} parentObject
- The object to clone and extend
- {Object} ...extensions
- the extensions
<static>
{Number}
Obj.getRandomInt(min, max)
Returns a random integer between min and max
- Parameters:
- {Number} min
- The minimum
- {Number} max
- The maximum
- Returns:
- {Number} the random number
<static>
{Number}
Obj.getUniqueId()
Returns a unique ID (random integer between 0 and 65536)
- Returns:
- {Number} the random number
<static>
Obj.hasProperties(ob, nonEnumProps, ownPropsOnly)
Returns true if the passed object has any properties, otherwise returns false.
- Parameters:
- {Object} ob
- Inspected object
- {Object} nonEnumProps
- If set to true, check also non-enumerable properties (optional)
- {Object} ownPropsOnly
- If set to true, only check own properties not inherited (optional)
<static>
{boolean}
Obj.isNonNativeGetter(obj, propName)
Tells if the given property of the provided object is a non-native getter or not.
This method depends on PropertyPanel.jsm module available in Firefox 5+
isNonNativeGetter has been introduced in Firefox 7
The method has been moved to WebConsoleUtils.jsm in Fx 18
- Parameters:
- {object} obj
- The object that contains the property.
- {string} propName
- The property you want to check if it is a getter or not.
- Returns:
- {boolean} True if the given property is a getter, false otherwise.