Fork me on GitHub
#nbb
<
2022-07-02
>
borkdude07:07:54

You can now install bebo (renamed from dbb) from a CDN :)

deno install --allow-read --allow-net --name bebo 
and then:
bebo examples/server/example.cljs

馃槑 2
鉂わ笍 1
genRaiy11:07:05

something I would like for code is to be able to reuse some code between node and the browser. Shadow CLJS has support for additional conditional reader options to mix code that is targetted to the :browser or :node-script

genRaiy11:07:39

I don't know why the CLJS core team rejected it so don't want to get too deep into it here

genRaiy11:07:44

it would however be worth knowing whether you have plans for nbb to support these targets?

borkdude11:07:03

I think nbb just ignores :browser so that should already work. nbb itself respects the :org.babashka/nbb reader tag

馃憖 1
genRaiy11:07:01

something's not quite right

genRaiy11:07:14

I can share now as I'm doing a small open source project

genRaiy11:07:03

Is this how you expect it to be used?

genRaiy11:07:17

ah - I see I need to namespace it

genRaiy11:07:33

ok - works now! Thanks

genRaiy11:07:08

usually in Cursive one can tell the editor that macro p/-> should be treated as -> but we don't have that option for reader tags. I'll see if he has a ticket and open one otherwise. Is it supported in Calva?

Chris McCormick04:07:13

@U04V5V0V4 those conditional requires are how i did it in sitefox so it can be used with both nbb or shadow-cljs. i isolated all of these imports into a single namespace to keep it out of the codebase: https://github.com/chr15m/sitefox/blob/main/src/sitefox/deps.cljc i'm strongly considering just ditching non-es6 for shadow-cljs though so i don't have to do this.

genRaiy06:07:50

Ok cool. I'm assuming you use shadow for the browser side.

馃憤 1
borkdude06:07:02

Yeah, if you use target esm in shadow, you don't have to do this

borkdude18:07:07

Bebo can now also load a .cljs file remotely :-)

bebo run 

鉂わ笍 2
馃殌 3
clojure-spin 4
Karol W贸jcik19:07:47

My head has just exploded 馃く馃く!

borkdude19:07:18

Now there is also a run.ts script that you can invoke to preserve the permission flags:

deno run --allow-net   

馃殌 1
genRaiy21:07:48

I only just realized that I can use scittle as a way to make a UI to test Lambdas made it nbb - awesome!

馃帀 2
馃槑 2
valtteri07:07:17

Sounds interesting! What does it look like in practice?

genRaiy08:07:47

I'll post a link once it's working. First I had to realise it was an option. But if you look at scittle you will see that it supports fetch

borkdude10:07:37

scittle allows any JS interop so if your browser supports fetch, you should indeed be able to use that

1
genRaiy11:07:55

are there browsers that do not?

borkdude11:07:07

Nowadays I think all browsers support it

genRaiy12:07:26

could scittle include promesa? Cos that makes interop with fetch a lot simpler.

borkdude12:07:51

@U04V5V0V4 I think that would be a good idea

borkdude12:07:01

Can you post an issue?

borkdude12:07:06

Btw, there is also an http client available: https://babashka.org/scittle/#cljs-ajax But since fetch is available, maybe I'll deprecate it in the future, unless someone thinks it's worth keeping

genRaiy12:07:20

you already have an issue to deprecate cljs-ajax 馃槈

borkdude12:07:51

I do, but if someone feels it has benefits over fetch, then I'll keep it

1