diff --git a/README.md b/README.md index 73a84e1..3cf5958 100755 --- a/README.md +++ b/README.md @@ -38,16 +38,22 @@ Here is a basic comparison: _object.js_ ```javascript -var L = object.Constructor('L', Array, { - constructor_attr: 'constructor', - - method: function(){ - return 'constructor' - }, -}, { +var A = object.Constructor('A', { // prototype attribute (inherited)... attr: 'prototype', + method: function(){ + // ... + }, +}) + +var B = object.Constructor('B', A, { + constructor_attr: 'constructor', + + constructor_method: function(){ + return 'constructor' + }, +}, { get prop(){ return 42 }, @@ -58,8 +64,8 @@ var L = object.Constructor('L', Array, { ``` - Clear separation of constructor and `.prototype` data: - - First block (optional) is merged with `L`, - - Second block _is_ the `L.prototype`, + - First block (optional) is merged with `B`, + - Second block _is_ the `B.prototype`, - no direct way to do "private" definitions. @@ -67,16 +73,22 @@ var L = object.Constructor('L', Array, { _ES6_ ```javascript -class L extends Array { - static constructor_attr = 'class' - - static method(){ - return 'class' - } - +class A { // instance attribute (copied)... attr = 'instance' + method(){ + // ... + } +} + +class B extends A { + static constructor_attr = 'class' + + static constructor_method(){ + return 'class' + } + get prop(){ return 42 } @@ -91,6 +103,15 @@ class L extends Array { - `static` and instance definitions are not ordered, - `.attr` is copied to every instance + + + + + + + + +