Fork me on GitHub
#nbb
<
2022-06-18
>
Alexander Carls08:06:44

I am using a JavaScript library that re-binds this at runtime in order to access this from an object literal. Some quick searching let me to the this-as macro. However, this doesn't resolve with nbb.

Could not resolve symbol: this-as
I am new to Clojure, am I missing something here?

borkdude08:06:18

@xander.carls Unfortunately this-as isn't supported in nbb :( but if you show me your code, perhaps I can recommend a workaround

Alexander Carls09:06:41

Well, when trying to extract an example for you I found a workaround that works :) It was from this MarkDoc Library here: https://github.com/markdoc/docs/blob/main/markdoc/nodes/heading.markdoc.js#L29 I thought that this.render is binding the fn and executing it in some context., however here it refers to the Symbol Heading. Passing a string "Heading" instead of this.renderworks.

👍 1
borkdude19:06:21

Some people have asked for merch for my OSS projects (stickers, t-shirts). Here's a link to all the products: https://clojurians.slack.com/archives/CLX41ASCS/p1655582061874859?thread_ts=1655492617.008949&amp;cid=CLX41ASCS