quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

commit 16a5b9d0d7de81aa8c3d9e4c580dafa2ee567c1d
parent 988e9fefd7ed105455e90d820f1865c0bf095709
Author: Florian Dold <florian@dold.me>
Date:   Tue,  3 Jan 2023 10:51:08 +0100

wip

Diffstat:
Mquickjs/quickjs-libc.c | 6++++--
Mwallet-client-example.c | 6+++++-
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/quickjs/quickjs-libc.c b/quickjs/quickjs-libc.c @@ -4062,7 +4062,7 @@ void js_os_set_host_message_handler(JSContext *ctx, JSHostMessageHandlerFn f, vo { JSThreadState *ts = JS_GetRuntimeOpaque(JS_GetRuntime(ctx)); ts->host_message_handler_f = f; - ts->host_message_handler_cls = f; + ts->host_message_handler_cls = cls; } static JSValue js_os_postHostMessage(JSContext *ctx, JSValueConst this_val, @@ -4077,10 +4077,12 @@ static JSValue js_os_postHostMessage(JSContext *ctx, JSValueConst this_val, return JS_EXCEPTION; } - if (ts->host_message_handler_f) { + if (NULL != ts->host_message_handler_f) { ts->host_message_handler_f(ts->host_message_handler_cls, s); } + JS_FreeCString(ctx, s); + return JS_UNDEFINED; } diff --git a/wallet-client-example.c b/wallet-client-example.c @@ -38,7 +38,11 @@ int main(int argc, char **argv) TALER_WALLET_run(wh); - TALER_WALLET_send_message(wh, "{}"); + TALER_WALLET_send_message(wh, "{\"operation\": \"init\", \"payload\": {\"skipDefaults\": true}}"); + + TALER_WALLET_send_message(wh, "{\"operation\": \"getVersion\"}"); + + //TALER_WALLET_send_message(wh, "{}"); // Wait for wallet thread to finish. // If we don't call this, main() exits