JS bindings - JsObject vs ref object

2021-06-09 Thread mantielero
If I have the following code: import jsffi type A = ref object of JsObject var a = A() a["name"] = cstring"Joe" Run I get the following: On the other hand, the following code: import jsffi type B = ref object o

JS bindings - JsObject vs ref object

2021-06-09 Thread juancarlospaco
I do not understand the question. Make a constructor ?.

JS bindings - JsObject vs ref object

2021-06-08 Thread mantielero
Thanks a lot. One more topic is that, in some cases the properties are predefined in the object definition: Selection* {.importc.} = ref object ## see `docs`_ anchorNode*: Node anchorOffset*: int

JS bindings - JsObject vs ref object

2021-06-08 Thread juancarlospaco
`ref object of JsRoot` JsObject is kinda too generic too abstract, is like using "auto" everywhere.

JS bindings - JsObject vs ref object

2021-06-08 Thread mantielero
I am wondering about what is the difference between both approaches. I see that [dom.nim](https://github.com/nim-lang/Nim/blob/44e653a9314e1b8503f0fa4a8a34c3380b26fff3/lib/js/dom.nim#L118-L126) uses `ref object`with `{.importc.}` pragma. On the other hand I have used `JsObject` just adding keys