update kajax.nim to use the 'kxi' context too
This commit is contained in:
parent
b3fba429ad
commit
28c4f4b76a
1 changed files with 9 additions and 6 deletions
|
|
@ -7,10 +7,11 @@ 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) =
|
||||||
proc contWrapper(httpStatus: int; response: cstring) =
|
proc contWrapper(httpStatus: int; response: cstring) =
|
||||||
cont(httpStatus, response)
|
cont(httpStatus, response)
|
||||||
redraw()
|
redraw(kxi)
|
||||||
|
|
||||||
type
|
type
|
||||||
HttpRequest {.importc.} = ref object
|
HttpRequest {.importc.} = ref object
|
||||||
|
|
@ -39,12 +40,14 @@ proc ajax(meth, url: cstring; headers: openarray[(cstring, cstring)];
|
||||||
|
|
||||||
proc ajaxPost*(url: cstring; headers: openarray[(cstring, cstring)];
|
proc ajaxPost*(url: cstring; headers: openarray[(cstring, cstring)];
|
||||||
data: cstring;
|
data: cstring;
|
||||||
cont: proc (httpStatus: int, response: cstring)) =
|
cont: proc (httpStatus: int, response: cstring);
|
||||||
ajax("POST", url, headers, data, cont)
|
kxi: KaraxInstance = kxi) =
|
||||||
|
ajax("POST", url, headers, data, cont, kxi)
|
||||||
|
|
||||||
proc ajaxGet*(url: cstring; headers: openarray[(cstring, cstring)];
|
proc ajaxGet*(url: cstring; headers: openarray[(cstring, cstring)];
|
||||||
cont: proc (httpStatus: int, response: cstring)) =
|
cont: proc (httpStatus: int, response: cstring);
|
||||||
ajax("GET", url, headers, nil, cont)
|
kxi: KaraxInstance = kxi) =
|
||||||
|
ajax("GET", 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