mirror of
https://github.com/flynx/object.js.git
synced 2025-10-30 11:00:08 +00:00
updated docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
aea2355520
commit
64d3de1fd2
10
README.md
10
README.md
@ -212,9 +212,19 @@ parent(<method>, <this>)
|
|||||||
-> undefined
|
-> undefined
|
||||||
```
|
```
|
||||||
|
|
||||||
|
_Edge case: The `parent(<method>, ..)` has one flaw -- it can't distinguish
|
||||||
|
between two references to the same method in a chain and will always
|
||||||
|
return the first, so the first case is preferable. This issue can't be
|
||||||
|
resolved as this case has no information on the prototype containing the
|
||||||
|
reference, but these cases should not be very common._
|
||||||
|
|
||||||
|
|
||||||
Get parent method and call it
|
Get parent method and call it
|
||||||
```
|
```
|
||||||
parentCall(<prototype>, <name>, <this>)
|
parentCall(<prototype>, <name>, <this>)
|
||||||
|
-> <result>
|
||||||
|
-> undefined
|
||||||
|
|
||||||
parentCall(<method>, <this>)
|
parentCall(<method>, <this>)
|
||||||
-> <result>
|
-> <result>
|
||||||
-> undefined
|
-> undefined
|
||||||
|
|||||||
@ -149,6 +149,7 @@ function(proto, name){
|
|||||||
function(obj){ return 'stop' })
|
function(obj){ return 'stop' })
|
||||||
.pop()
|
.pop()
|
||||||
return res ?
|
return res ?
|
||||||
|
// get next value...
|
||||||
res.__proto__[name]
|
res.__proto__[name]
|
||||||
: undefined }
|
: undefined }
|
||||||
|
|
||||||
@ -162,7 +163,8 @@ function(proto, name){
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
// This also gracefully handles the case when no higher level definition
|
// This also gracefully handles the case when no higher level definition
|
||||||
// is found, i.e. the corresponding parent(..) call will return undefined.
|
// is found, i.e. the corresponding parent(..) call will return undefined
|
||||||
|
// or a non-callable.
|
||||||
//
|
//
|
||||||
// NOTE: this is just like parent(..) but will call the retrieved method,
|
// NOTE: this is just like parent(..) but will call the retrieved method,
|
||||||
// essentially this is a shorthand to:
|
// essentially this is a shorthand to:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user