-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Chaining (v0.2.x)
MetaSean edited this page Jan 26, 2016
·
1 revision
Chained functions may be context independent of their proceeding function, or they may be dependent on the results of the proceeding function. 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 function, in this case theputfunction - i.e., both
keyandvalare dependent on the results ofput
-
| .put( ) | .get( ) | .path( ) | .map( ) | .all( ) | .key( ) | .val( ) | .on( ) | |
|---|---|---|---|---|---|---|---|---|
| .put( ).___ | D | i | D | D | i | D | D | D |
| .get( ).___ | D | i | D | D | i | D | D | D |
| .path( ).___ | D | i | D | D | i | D | D | D |
| .map( ).___ | D | i | D | D | i | D | D | D |
| .all( ).___ | i | i | D | D | i | i | D | D |
| .key( ).___ | i | i | i | i | i | i | i | i |
| .val( ).___ | i | i | i | i | i | i | i | i |
| .on( ).___ | i | i | i | i | i | i | i | i |
Rows represent the initial function, while columns represent the subsequent function.
- D : Subsequent function is dependent on the previous function.
- i : Subsequent function is independent of the previous function.