Fork me on GitHub
#sci
<
2022-04-15
>
awb9900:04:11

I want to create a js object with functions in sci. Unfortunately deftype which csn do that is not defined in sci. Is there any way around that? My usecase is that I have to pass an existing javascript a js-object that has 3 functions. It is a type definition that internally uses this.

borkdude07:04:18

@hoertlehner Any reason to not just use #js {:a (fn [x]) :b (fn [y])} ?

awb9922:04:17

@borkdude the js librariy I use then cannot find the functtions. For sole stupid reason wanta a function that can be called with "new user-class ()"

awb9922:04:18

I have already loaded a pure javascript file and I tried to (create create-type-of "test1" a-fn b-fn). But so far I have failed.

awb9922:04:38

So the library would run this this js code: var t = new user-type (); t.a(123); t.b (456);