This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-26
Channels
- # announcements (2)
- # babashka (55)
- # beginners (107)
- # calva (65)
- # cider (5)
- # clara (4)
- # clj-kondo (17)
- # cljs-dev (38)
- # cljsrn (16)
- # clojure (117)
- # clojure-australia (8)
- # clojure-europe (13)
- # clojure-italy (4)
- # clojure-nl (5)
- # clojure-provo (2)
- # clojure-sweden (9)
- # clojure-taiwan (1)
- # clojure-uk (41)
- # clojurescript (40)
- # code-reviews (1)
- # conjure (40)
- # cursive (4)
- # datomic (11)
- # events (2)
- # fulcro (33)
- # graalvm (1)
- # jobs (2)
- # jobs-discuss (19)
- # lsp (18)
- # off-topic (58)
- # polylith (2)
- # quil (2)
- # react (28)
- # reagent (35)
- # reitit (3)
- # remote-jobs (1)
- # ring (9)
- # sci (76)
- # shadow-cljs (19)
- # sql (10)
- # testing (5)
- # vim (13)
- # xtdb (5)
With sci-tag, is there a way to export a map of function to JS Land?
so that we have the ability to group our functions into namespace like object/data structure)
I got it, use js-obj 🙂
@neo2551 You can make a JavaScript object with functions using clj->js
and then use set!
to set it to the window object
Thanks!
Perfect! 🙂
haha, this is clearly some super power you provided us xD
duh, I was tired hahaha thx
@jeroenvandijk a thought: I guess we could distribute both advanced and simple builds, then people can choose. If they only need sci + maybe reagent, they can use the advanced ones. If they want plugins from third parties they can use the simple ones.
Yeah I think the advanced is necessary to keep it light weight. And like with Babashka, the most used libraries can be part of your repo through PRs? Not sure about this maintenance burden. If it grows too big for one repo, maybe a similar approach a with the pods could work?
the pod approach isn't so nice for CLJS since each part has to bring its own implementation of CLJS core, data structures etc
with bb pods this is also the case, but less of a problem since you can cache the downloads pretty well and on servers downloads are less problematic than on web pages
Yeah true
and the minimum pod size with clojure is about 10mb which is not so big for a binary you have to download, but for a JS file it is
yeah I guess you could do a lot with caching and cdn’s, but it would be very unfriendly for first time visitors
Do you think we could create a core that exports all vars from namespaces? https://github.com/borkdude/sci/blob/master/src/sci/impl/namespaces.cljc#L730
And then only do a small part advanced?
I mean renamed via advanced. Maybe the plugins don’t need to repeat that much in that case
Maybe wait indeed until we have enough motivation to explore this
haha nice
I’ll ask you for naming suggestions when I create a new project 💪
Btw, not sure if you think it’s useful but I think some bookmarklet examples are also cool. I played with it last year https://gist.github.com/jeroenvandijk/2c54cfcfacd61a97962c0504a77cacc3
Perhaps you can make a PR with a bookmarklet.html page (we already have a tictactoe.html page)
Yeah I’ll try to come up with something fun
a heads up, you now must provide your own React when using the reagent plugin:
<script crossorigin src=""></script>
<script crossorigin src=""></script>
<script src="" type="application/javascript"></script>
you can also provide a development React version, for better error messages this way
Is there are a way to evaluate Sci code after the dom has loaded? Maybe I need evalString for my bookmarklet
I.e. this triggers an alert
s=document.createElement("script");s.innerText="alert('js')";document.body.appendChild(s)
but this doesn’t
s=document.createElement("script");s.setAttribute('type', 'application/x-sci');s.innerText="(js/alert \"cljs\")";document.body.appendChild(s)
I’m not sure if you can add dom events for loading custom application types. Otherwise I need something like sci.evalString
Same as the highlight JS plugin, it has
hljs.highlightAll();
Perhaps that's more flexible than doing it automaticallyI think the implicit way is fine for most users. The bookmarklet case is very specific. I just need a
way 😅
maybe eval-string is actually cleaner for my use case. I don’t know about other use cases
yeah correct. Only for the plugins (scittle and scittle-reagent)
The project is now renamed to scittle: https://borkdude.github.io/scittle/
Why not?
@borkdude I have a basic bookmarklet example. What is a good place to put it?
works locally. I used absolute urls though https://github.com/borkdude/scittle/pull/1/files#diff-25c3650694da19d8dce442cc761a939f823b5bbba41bd7ac90eba3a93083b841R5 as /js
is not in resources/public
locally
FYI, i added two small fixes for a better editting experience 🙂 https://github.com/borkdude/scittle/pull/2
I was missing the nice debugging experience of babashka. <----
stacktraces i mean. Maybe something to add later
@jeroenvandijk how is the bookmarklet working if you navigate away from the page?
You drag the link to your bookmark page and you can use it on any page (that doesn’t set restrictions)
It will throw an error if the scittle js can’t be loaded due to restrictions (e.g. try http://github.com)
If you google you will find some inspiration e.g. https://www.howtogeek.com/125846/the-most-useful-bookmarklets-to-enhance-your-browsing-experience/
I had some handy ones before in js, but stopped using it. Now with Scittle i’m motivated to write some myself