mirror of
https://github.com/urbit/shrub.git
synced 2024-12-12 10:29:01 +03:00
refactored tree json into separate hooks
This commit is contained in:
parent
6c65a950e0
commit
fba6d51505
@ -1139,12 +1139,15 @@ module.exports = invariant;
|
||||
|
||||
},{}],14:[function(require,module,exports){
|
||||
module.exports = {
|
||||
get: function(path, query, cb) {
|
||||
get: function(path, type, cb) {
|
||||
var url;
|
||||
url = (window.tree.basepath(path)) + ".json";
|
||||
if (query) {
|
||||
url += "?" + query;
|
||||
if (type == null) {
|
||||
type = "body";
|
||||
}
|
||||
if (path[0] !== "/") {
|
||||
path = "/" + path;
|
||||
}
|
||||
url = (window.tree.basepath(type + path)) + ".json";
|
||||
return $.get(url, {}, function(data) {
|
||||
if (cb) {
|
||||
return cb(null, data);
|
||||
|
@ -1,5 +1,5 @@
|
||||
module.exports =
|
||||
get: (path,query,cb) ->
|
||||
url = "#{window.tree.basepath(path)}.json"
|
||||
if query then url += "?#{query}"
|
||||
get: (path,type="body",cb) ->
|
||||
if path[0] isnt "/" then path = "/" + path
|
||||
url = "#{window.tree.basepath(type+path)}.json"
|
||||
$.get url, {}, (data) -> if cb then cb null,data
|
||||
|
22
tree/body/json.hook
Normal file
22
tree/body/json.hook
Normal file
@ -0,0 +1,22 @@
|
||||
::
|
||||
:::: /hook/json/body/tree
|
||||
::
|
||||
/? 314
|
||||
/= gas /$ fuel
|
||||
/= dat /: /=== /% /react-json/
|
||||
::
|
||||
::::
|
||||
::
|
||||
// /%%%/util
|
||||
::
|
||||
[util=. +>]
|
||||
::
|
||||
!:
|
||||
::::
|
||||
::
|
||||
^- json
|
||||
=+ ~(. util gas)
|
||||
%- jobe :~
|
||||
kids/[%a (turn get-kids |=(a=span s/a))]
|
||||
body/dat
|
||||
==
|
@ -1,52 +0,0 @@
|
||||
::
|
||||
/? 314
|
||||
/= gas /$ fuel
|
||||
/= ral /: /=== /% /react-json/
|
||||
/= pal /: /===
|
||||
/^ (map ,@ta json)
|
||||
/% 2
|
||||
/_ /react-json/
|
||||
::
|
||||
/= sal /: /===
|
||||
/^ (map ,@ta json)
|
||||
/% 2
|
||||
/_ /react-snips-json/
|
||||
::
|
||||
::::
|
||||
::
|
||||
// /%%/util
|
||||
::
|
||||
[util=. +>]
|
||||
::
|
||||
!:
|
||||
::::
|
||||
::
|
||||
^- json
|
||||
=+ ~(. util gas)
|
||||
:: .json?kids
|
||||
?: (~(has by qix.gas) %kids)
|
||||
%+ joba %kids
|
||||
=. pal (~(del by pal) %md) :: XX haxor
|
||||
=- [%a (turn (~(tap by pal)) -)]
|
||||
|= [a=span b=json]
|
||||
%- jobe :~
|
||||
name/s/a
|
||||
body/b
|
||||
==
|
||||
:: .json?snip
|
||||
?: (~(has by qix.gas) %snip)
|
||||
%+ joba %snip
|
||||
=. sal (~(del by sal) %md) :: XX haxor
|
||||
=- [%a (turn (~(tap by sal)) -)]
|
||||
|= [a=span b=json]
|
||||
=+ fon=(json-front b)
|
||||
%- jobe :~
|
||||
meta/fon
|
||||
name/s/a
|
||||
body/b
|
||||
==
|
||||
:: .json
|
||||
%- jobe :~
|
||||
kids/[%a (turn get-kids |=(a=span s/a))]
|
||||
body/ral
|
||||
==
|
28
tree/kids/json.hook
Normal file
28
tree/kids/json.hook
Normal file
@ -0,0 +1,28 @@
|
||||
::
|
||||
:::: /hook/json/kids/tree
|
||||
::
|
||||
/? 314
|
||||
/= gas /$ fuel
|
||||
/= dat /: /===
|
||||
/^ (map ,@ta json)
|
||||
/% 2
|
||||
/_ /react-json/
|
||||
::
|
||||
::::
|
||||
::
|
||||
// /%%%/util
|
||||
::
|
||||
[util=. +>]
|
||||
::
|
||||
!:
|
||||
::::
|
||||
::
|
||||
^- json
|
||||
=+ ~(. util gas)
|
||||
%+ joba %kids
|
||||
=- [%a (turn (~(tap by dat)) -)]
|
||||
|= [a=span b=json]
|
||||
%- jobe :~
|
||||
name/s/a
|
||||
body/b
|
||||
==
|
30
tree/snip/json.hook
Normal file
30
tree/snip/json.hook
Normal file
@ -0,0 +1,30 @@
|
||||
::
|
||||
:::: /hook/json/snip/tree
|
||||
::
|
||||
/? 314
|
||||
/= gas /$ fuel
|
||||
/= dat /: /===
|
||||
/^ (map ,@ta json)
|
||||
/% 2
|
||||
/_ /react-snips-json/
|
||||
::
|
||||
::::
|
||||
::
|
||||
// /%%%/util
|
||||
::
|
||||
[util=. +>]
|
||||
::
|
||||
!:
|
||||
::::
|
||||
::
|
||||
^- json
|
||||
=+ ~(. util gas)
|
||||
%+ joba %snip
|
||||
=- [%a (turn (~(tap by dat)) -)]
|
||||
|= [a=span b=json]
|
||||
=+ fon=(json-front b)
|
||||
%- jobe :~
|
||||
meta/fon
|
||||
name/s/a
|
||||
body/b
|
||||
==
|
Loading…
Reference in New Issue
Block a user