Fork me on GitHub
#scittle
<
2023-08-03
>
rickheere18:08:45

Hi, I didn't have time to try something out myself but I have an idea. With this library it's possible to run scripts from a script tag just like scittle but also from a tag with the _ (underscore) attribute. The code is applied to the tag it is found on. Would it be possible to have something like this in scittle as well?

borkdude18:08:45

Sure you can do this in user space with scittle already. Just write some JS interop and use scittle.core/eval_string

rickheere18:08:48

Alright I'll try that out when I have some time, thanks.

rickheere08:08:28

I needed to save my ref to the element on the window so I can get it back later. Can I improve that somehow?

borkdude08:08:04

why not make the scittle attribute a function so you pass the ref:

(fn [{:keys [ref]}] ....)

rickheere09:08:29

Yeah that works very well, I was not aware js/scittle.core.eval_string would return a function, I thought it would just read and execute code from a string 😅. Thank you!

rickheere09:08:03

☝️ code is updated for who is interested.

👍 2
2