mirror of
https://github.com/flynx/object.js.git
synced 2025-10-30 19:10:11 +00:00
minor fixes to docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
1d36658451
commit
e97f3e4a6b
@ -1,15 +1,15 @@
|
|||||||
# object.js
|
# object.js
|
||||||
|
|
||||||
object.js provides a set of tools for constructing and maintaining object
|
object.js provides a set of tools for constructing and maintaining object
|
||||||
constrictors and for managing their inheritance relations.
|
constructors and for managing their inheritance relations.
|
||||||
|
|
||||||
|
|
||||||
This is an elternative to the ES6 `class` syntax in JavaScript and provides
|
This is an alternative to the ES6 `class` syntax in JavaScript and provides
|
||||||
several advantages:
|
several advantages:
|
||||||
- simple way to define normal and class methods, properties and attributes,
|
- simple way to define normal and class methods, properties and attributes,
|
||||||
- uniform and minimalistic definition syntax based on basic JavaScript
|
- uniform and minimalistic definition syntax based on basic JavaScript
|
||||||
object syntax no special cases or special syntax,
|
object syntax no special cases or special syntax,
|
||||||
- _transparantly_ based on _JavaScript's_ prototypical inheritance model,
|
- _transparently_ based on _JavaScript's_ prototypical inheritance model,
|
||||||
- more granular instance construction (a-la _Python's_ `.__new__(..)`
|
- more granular instance construction (a-la _Python's_ `.__new__(..)`
|
||||||
and `.__init__(..)` methods)
|
and `.__init__(..)` methods)
|
||||||
- less restrictive:
|
- less restrictive:
|
||||||
@ -17,7 +17,7 @@ several advantages:
|
|||||||
- all input components are reusable
|
- all input components are reusable
|
||||||
|
|
||||||
Disadvantages compared to the `class` syntax:
|
Disadvantages compared to the `class` syntax:
|
||||||
- no _sytactic sugar_
|
- no _syntactic sugar_
|
||||||
- a slightly more complicated `super` call method
|
- a slightly more complicated `super` call method
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,13 +2,11 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
* XXX should this extend Object???
|
||||||
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define)(
|
((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define)(
|
||||||
function(require){ var module={} // makes module AMD/node compatible...
|
function(require){ var module={} // makes module AMD/node compatible...
|
||||||
/*********************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
// Helpers...
|
// Helpers...
|
||||||
|
|
||||||
@ -25,6 +23,8 @@ module.TAB_SIZE = 4
|
|||||||
// for printing function code of functions that were defined at deep levels
|
// for printing function code of functions that were defined at deep levels
|
||||||
// of indent.
|
// of indent.
|
||||||
//
|
//
|
||||||
|
// NOTE: this will trim out both leading and trailing whitespace.
|
||||||
|
//
|
||||||
// XXX is this the right place for this???
|
// XXX is this the right place for this???
|
||||||
// ...when moving take care that ImageGrid's core.doc uses this...
|
// ...when moving take care that ImageGrid's core.doc uses this...
|
||||||
var normalizeIndent =
|
var normalizeIndent =
|
||||||
@ -310,6 +310,7 @@ function Constructor(name, a, b){
|
|||||||
// default object base...
|
// default object base...
|
||||||
: {}
|
: {}
|
||||||
|
|
||||||
|
// XXX should this be done when .__new__(..) is called???
|
||||||
obj.__proto__ = _constructor.prototype
|
obj.__proto__ = _constructor.prototype
|
||||||
Object.defineProperty(obj, 'constructor', {
|
Object.defineProperty(obj, 'constructor', {
|
||||||
value: _constructor,
|
value: _constructor,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user