Skip to content

Commit e580620

Browse files
author
blik
committed
temporary route graph on feed fragment
1 parent cceb6e9 commit e580620

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

Blik_2023_fragment.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,15 @@
618618
let peer=document({div:{}});
619619
yield peer;
620620
await compose(Object.entries,provide,each(compose(consume,author,peer.append.bind(peer))),collect)(sub);
621+
peer.append(document(
622+
{hr:{style:"margin-top:3em"}
623+
,h3:{"#text":"Data-driven routing:"}
624+
,span:{"#text":"(until the Form island becomes obvious)"}
625+
}));
626+
await compose(resolve,peer.append.bind(peer))
627+
("./Blik_2024_network.js","default",arguments[0]
628+
,{spread:"force",linear:true,gradual:true,source}
629+
);
621630
};
622631

623632
async function author({source,common,...feed},index)
@@ -962,11 +971,11 @@
962971
deferred.forEach(event=>this.addEventListener(event.slice(2),refer,{passive:false}));
963972
actions.then(actions=>
964973
new Set(Object.values(actions).flatMap(Object.keys)).forEach(event=>
965-
this.addEventListener(event,delegate.bind(actions),{passive:false}))).then(ready=>
974+
this.addEventListener(event,delegate.bind(actions),{passive:false}))||
975+
console.groupCollapsed("routing all propagated events to actions from scope: ",{fragment:this})||
976+
console.log({[globalThis.window.location.origin+lead+module]:actions})||
977+
console.groupEnd()).then(ready=>
966978
deferred.forEach(event=>this.removeEventListener(event.slice(2),refer)));
967-
console.groupCollapsed("routing all propagated events to actions from scope: ",{fragment:this});
968-
console.log({[globalThis.window.location.origin+lead+module]:actions});
969-
console.groupEnd();
970979
return this;
971980
};
972981

Blik_2024_static.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@
2828
};
2929

3030
let format=compose("url",query,either("format",swap("binary")));
31-
32-
export default
33-
{get:compose(combine(compose
34-
(swap("path","resolve","./"),resolve,true,classified,remember(compose(drop(1),list),source=>source)//,list
35-
,tether(prune,([field,value],path)=>value===null
31+
let unfold=combine(compose(drop(1),"url",slip("url","parse"),resolve,"pathname"),crop(1));
32+
let fold=whether(is("/get"),compose(drop(1),infer(scope,([field,value])=>
33+
/[()]/.test(value.name)?value.name:serialize(value,null))),swap({}));
34+
let route=tether(prune,([field,value],path)=>value===null
3635
?describe(compose(drop(1),combine
3736
(compose(swap([path,field].flat().join("/")),pass(permit,classified)),format
3837
),access),field)
39-
:value)
40-
),compose
41-
(combine(compose(drop(1),"url",slip("url","parse"),resolve,"pathname"),crop(1))
42-
,whether(is("/get"),compose(drop(1),infer(scope,([field,value])=>
43-
/[()]/.test(value.name)?value.name:serialize(value,null))),swap({}))
44-
)),merge)
38+
:value);
39+
40+
export default
41+
{get:compose(combine(compose
42+
(swap("path","resolve","./"),resolve,true,classified
43+
,remember(compose(drop(1),list),source=>source),route
44+
),compose(unfold,fold)),merge)
4545
,put:compose
4646
(drop(1),pass(buffer(combine
4747
(compose(path,slip("path","resolve","./"),resolve,published,true,permit)

0 commit comments

Comments
 (0)