-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Chaining (v0.3.x)
omarzion edited this page Jun 8, 2017
·
4 revisions
Chained methods may be context independent of their proceeding method, or they may be dependent on the results of the preceding method. The Chaining Dependency Table below shows the relationship between immediately adjacent, chained functions.
-
gun.put({ hello: "world" }).key("my/data")-
keyproceeded byputis dependent on the results ofput - i.e. the
keywill be assigned to the same object as theput
-
-
gun.put({ hello: "world" }).key("my/data").val(function (data) {})-
valproceeded bykeyis independent of the results ofkey, thereforevalwill work its way back to the previous dependent method, in this case theputmethod - i.e., both
keyandvalare dependent on the results ofput
-
| .put( ) | .get( ) | .path( ) | .map( ) | .key( ) | .val( ) | .on( ) | |
|---|---|---|---|---|---|---|---|
| .put( ).___ | D | i | D | D | D | D | D |
| .get( ).___ | D | i | D | D | D | D | D |
| .path( ).___ | D | i | D | D | D | D | D |
| .map( ).___ | D | i | D | D | D | D | D |
| .key( ).___ | i | i | i | i | i | i | i |
| .val( ).___ | i | i | i | i | i | i | i |
| .on( ).___ | i | i | i | i | i | i | i |
| .not( ).___ | D | i | D | D | D | D | D |
Rows represent the initial method, while columns represent the subsequent method.
- D : Subsequent method is dependent on the previous method.
- i : Subsequent method is independent of the previous method.