Skip to content

Commit 497a5b8

Browse files
author
jin
committedDec 29, 2024
$mol_source - dataloader abstraction, experiment
1 parent 374764d commit 497a5b8

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
 

‎source/http/http.ts

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
namespace $ {
2+
export class $mol_source_http_json extends $mol_source {
3+
4+
query() {
5+
return {}
6+
}
7+
8+
base() {
9+
return ''
10+
}
11+
12+
@ $mol_mem
13+
uri() {
14+
let url = this.base()
15+
16+
const search = '' + new URLSearchParams( this.query() )
17+
if( search ) url += ( url.includes( '?' ) ? '&' : '?' ) + search
18+
19+
return url
20+
}
21+
22+
@ $mol_mem
23+
output() {
24+
return this.$.$mol_fetch.json( this.uri() )
25+
}
26+
27+
}
28+
}

‎source/source.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace $ {
2+
export class $mol_source extends $mol_object2 {
3+
4+
output() {
5+
return null as any
6+
}
7+
8+
}
9+
}

0 commit comments

Comments
 (0)