Initial project import
This commit is contained in:
commit
23f2d29e32
11957 files changed
+1754577
No files matched your search
@@ -0,0 +1,6 @@
|
||||
## Description
|
||||
|
||||
`js` is frontend/browser specific module, that provides access to global JS functions.
|
||||
|
||||
> **Note**
|
||||
> It *only* works with the JS backend.
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,2 @@
|
||||
// DOM API wrapper
|
||||
module dom
|
||||
@@ -0,0 +1,33 @@
|
||||
module js
|
||||
|
||||
import js.promise
|
||||
|
||||
pub fn JS.fetch(input JS.String, init JS.Object) JS.Promise
|
||||
|
||||
pub interface JS.Body {
|
||||
body JS.Uint8Array
|
||||
bodyUse JS.Boolean
|
||||
blob() JS.Promise
|
||||
json() JS.Promise
|
||||
text() JS.Promise
|
||||
}
|
||||
|
||||
pub interface JS.Response {
|
||||
JS.Body
|
||||
ok JS.Boolean
|
||||
redirected JS.Boolean
|
||||
status JS.Number
|
||||
statusText JS.String
|
||||
url JS.String
|
||||
clone() JS.Response
|
||||
}
|
||||
|
||||
pub fn fetch(input string, init map[string]JS.Any) promise.Promise[JS.Response, JS.String] {
|
||||
p_init := JS.Any(unsafe { nil })
|
||||
p := promise.Promise[JS.Response, String]{p_init}
|
||||
|
||||
#let obj = {}; for (let [key,val] of init.map) { obj[key] = val; }
|
||||
#p.promise = fetch(input.str,obj);
|
||||
|
||||
return p
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
// Module containing various JS APIs wrappers.
|
||||
|
||||
module js
|
||||
Reference in new issue
Block a user