Fork me on GitHub
#clojurescript
<
2018-10-02
>
richiardiandrea01:10:13

I am in a newbie conundrum, I thought I had a good grasp of promises but I am slightly confused as to why this throws

richiardiandrea01:10:24

cljs.user=> (def f (js/Promise. #(throw (js/Error. "Test"))))
#'cljs.user/f
cljs.user=> (node:640) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): Error: Test

richiardiandrea01:10:09

no that's not the case ...a sec

richiardiandrea01:10:32

no I am confused never mind šŸ˜„

Digital Baboon07:10:04

@manutter51 @jesse.wertheim sorry for the late reply, thank you for the hashmap suggestion. I think multimethod works best for me right now.

eval202011:10:51

Iā€™m trying to use google closure-logging targeting node. With optimization-level none logging is visible, with simple itā€™s not. What am I missing?

maleghast13:10:23

This was posted to #jobs, but in case you are not monitoring that channel...

Braden Shepherdson15:10:45

I have some fairly straightforward hashmap data that needs to be stored flexibly on my server, sent to my (CLJS) client, and ideally stored in its IndexedDB or LocalStorage or whatever. I'm new to Clojure, though, and don't know where to look.

Braden Shepherdson15:10:09

by "stored flexibly" I mean "I don't get to pick the underlying storage layer"

Braden Shepherdson15:10:46

so whatever Clojure library I use needs to be flexible enough to be adapted to that storage layer.

martinklepsch15:10:55

@braden.shepherdson not sure I understand what you're looking for. Are you looking for recommendations how to persist hashmap style data on a Clojure server?

martinklepsch15:10:18

or are you looking for a library that allows you to persist hashmap style data on any storage layer? Maybe a bit more context on your situation would be helpful šŸ™‚

maleghast15:10:15

@braden.shepherdson - Are you interested in document store type DBs..? Would you consider using an RDBMS - I mean PostgreSQL can be used really flexibly as a mixture of both since the finalisation of JSONB on PostgreSQLā€¦ How about MongoDB / Riak / Redis / DynamoDB (if youā€™re on AWS)? Maybe you could just use text files to store serialised data structures, like EDN or JSON,,?

maleghast15:10:04

Clojure is very capable in using all of these paradigms and more. It really depends EXACTLY what you want šŸ™‚

isak16:10:12

can anyone recommend a good uml/graph type visualizer that runs in the browser?

mauricio.szabo15:10:31

I use yED. The desktop version is what I use, but there's an online version too

maleghast16:10:00

@isak - I used to use this when I had to draw such thingsā€¦ https://www.lucidchart.com/

maleghast16:10:34

They used to have a ā€œfreeā€ account, not sure any more, looks as though itā€™s a trial nowā€¦

isak16:10:31

@maleghast that one looks cool, but i'm hoping for something I can use as a library in my app

Braden Shepherdson16:10:40

sorry, I didn't give a lot of context. the underlying storage is not my choice, so I can't really use Riak or Mongo or whatever else. I was more looking for Clojure interfaces to data that I'm loading from somewhere, with bonus points if it can bridge to CLJS too. DataScript looks like the most promising thing some searching revealed.

maleghast16:10:50

Oh, sorry - I misunderstood @isak

maleghast16:10:36

@braden.shepherdson - Datascript will help you with that, for sure (based on what Iā€™ve read, no hands-on)

maleghast16:10:40

@isak - Yeah, that does look nice šŸ™‚

maleghast16:10:02

Has anyone CLJSJS-ed it yet? (Yes I am that lazy šŸ˜‰ )

isak16:10:02

@braden.shepherdson @maleghast with Datascript, one thing you might want to check first is how quickly you can initialize a database. I did some tests, and my SQL queries took like 5 seconds, but initializing datascript in memory with that data took like 25 seconds.

maleghast16:10:45

@isak - Crikey, thatā€™s quite a start-up penalty!

isak16:10:46

@maleghast I haven't seen anything yet, agree that would be cool

Braden Shepherdson16:10:19

actually, now that I think about it, persistence is not strictly required. I could get away with purely in-memory, since some of the services I'm pulling new data from retain enough history to make a freshly-started server interesting.

Braden Shepherdson16:10:26

@isak where were you loading data from?

isak16:10:39

@braden.shepherdson SQL Server. Also tried via transit first, then sync from DB, but haven't gotten the load time down to a great level yet

kahlin19:10:30

Hi! I have a newbie question about cljsjs packages and how to use them... I'm trying to use firebase by adding cljsjs/firebase as a dependency. No problems so far but I'm not sure how to call firebase after that. I'm trying:

(ns ^:figwheel-hooks checklist.core
  (:require [ :as firebase-app]]))

(firebase-app/initializeApp #js{ ... })
But all I get is TypeError: firebase.app.initializeApp is not a function. Is this not how it's supposed to be used?

bhauman19:10:30

@kahlin you will need to access it via js/

kahlin19:10:13

Ahh... I see. I was under the impression that the :as firebase-app would allow me to not have to do that.

bhauman19:10:18

js/firebase.app

bhauman19:10:27

it really depends on how its packaged

kahlin19:10:07

You're right, the js/firebase... syntax works.

bhauman19:10:32

it looks like they want you to call firebase.initializeApp

kahlin19:10:13

Yup, exactly. js/firebase.initializeApp works like a charm.

kahlin19:10:16

Thanks!

šŸ‘ 4