Skip to content

Commit

Permalink
$mol_source - dataloader abstraction, experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
jin committed Dec 29, 2024
1 parent 374764d commit 497a5b8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
28 changes: 28 additions & 0 deletions source/http/http.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace $ {
export class $mol_source_http_json extends $mol_source {

query() {
return {}
}

base() {
return ''
}

@ $mol_mem
uri() {
let url = this.base()

const search = '' + new URLSearchParams( this.query() )
if( search ) url += ( url.includes( '?' ) ? '&' : '?' ) + search

return url
}

@ $mol_mem
output() {
return this.$.$mol_fetch.json( this.uri() )
}

}
}
9 changes: 9 additions & 0 deletions source/source.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace $ {
export class $mol_source extends $mol_object2 {

output() {
return null as any
}

}
}

0 comments on commit 497a5b8

Please sign in to comment.