From 8bdaab3f821ba902cf4d4d874714303bad1bc851 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Thu, 27 Apr 2017 17:57:04 +0200 Subject: [PATCH] uibenchmark works --- uibench/nim_uibench.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/uibench/nim_uibench.nim b/uibench/nim_uibench.nim index a9a7d96..2983686 100644 --- a/uibench/nim_uibench.nim +++ b/uibench/nim_uibench.nim @@ -96,8 +96,10 @@ proc a(state: AppState) = appState = state redrawForce() +proc myToJson[T](x: T): cstring {.importcpp: "JSON.stringify(#, null, ' ')".} + proc b(samples: RootRef) = - document.body.innerHTML = cstring"
" & toJson(samples) & cstring"
" + document.body.innerHTML = cstring"
" & myToJson(samples) & cstring"
" proc init*(a: cstring, b: cstring) {.importc: "uibench.init", nodecl.} proc run*(a: proc(state: AppState), b: proc(samples: RootRef)) {.importc: "uibench.run", nodecl.}