parent
b8c9ff45fe
commit
4571ad0dd5
1 changed files with 13 additions and 1 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import karax
|
import karax
|
||||||
|
|
||||||
proc ajax(meth, url: cstring; headers: openarray[(cstring, cstring)];
|
proc ajax*(meth, url: cstring; headers: openarray[(cstring, cstring)];
|
||||||
data: cstring;
|
data: cstring;
|
||||||
cont: proc (httpStatus: int; response: cstring);
|
cont: proc (httpStatus: int; response: cstring);
|
||||||
kxi: KaraxInstance = kxi) =
|
kxi: KaraxInstance = kxi) =
|
||||||
|
|
@ -49,5 +49,17 @@ proc ajaxGet*(url: cstring; headers: openarray[(cstring, cstring)];
|
||||||
kxi: KaraxInstance = kxi) =
|
kxi: KaraxInstance = kxi) =
|
||||||
ajax("GET", url, headers, nil, cont, kxi)
|
ajax("GET", url, headers, nil, cont, kxi)
|
||||||
|
|
||||||
|
proc ajaxPut*(url: cstring; headers: openarray[(cstring, cstring)];
|
||||||
|
data: cstring;
|
||||||
|
cont: proc (httpStatus: int, response: cstring);
|
||||||
|
kxi: KaraxInstance = kxi) =
|
||||||
|
ajax("PUT", url, headers, data, cont, kxi)
|
||||||
|
|
||||||
|
proc ajaxDelete*(url: cstring; headers: openarray[(cstring, cstring)];
|
||||||
|
cont: proc (httpStatus: int, response: cstring);
|
||||||
|
kxi: KaraxInstance = kxi) =
|
||||||
|
ajax("DELETE", url, headers, nil, cont, kxi)
|
||||||
|
|
||||||
|
|
||||||
proc toJson*[T](data: T): cstring {.importc: "JSON.stringify".}
|
proc toJson*[T](data: T): cstring {.importc: "JSON.stringify".}
|
||||||
proc fromJson*[T](blob: cstring): T {.importc: "JSON.parse".}
|
proc fromJson*[T](blob: cstring): T {.importc: "JSON.parse".}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue