Fork me on GitHub
#clojurescript
<
2019-02-05
>
Ramzi00:02:21

I'm watching them all. I tried following along the first few lectures. Now I'm just watching.

Ramzi00:02:28

i bought the extended lectures.

Drew Verlee00:02:34

Is there a way to distinguish between when a html5 system alert's onclose function gets run because the browser regains focus and when the close button is clicked?

bajrachar19:02:48

I am trying to load a foreign-lib in clojurescript which has a export default instead of a global name - how do I require the namespace in this case?

bajrachar19:02:47

I guess the :global-exports property here only works in case the external JS has a global name exported like above.

hoopes21:02:48

is there an easy way to tell with a single function whether something is a cljs data structure vs. a regular ol javascript data structure?

john21:02:17

Depends what you mean, but coll? could suffice in some situations, for detecting a cljs collection.

hoopes21:02:56

ok, thanks - i'll give it a shot

hoopes21:02:29

that might be what i need - i'm looking to always log plain JS, so that should do the job

hoopes21:02:30

thanks again!

john22:02:22

ah, gotcha. Well, there's also object? if you want to only log js objects (and not everything that's not a coll)

john22:02:25

Question for y'all React rangers out there: I'd like to be able to attach extra handlers to componentDidMount and other methods on arbitrary React components, whether they're native or some Reagent/Fulcro/other wrapper lib's component... possible?

john22:02:42

How do I get at the js component object's lifecycle methods, if the object is passed to my function?

lilactown23:02:22

@john are you being passed a React component or an element?

lilactown23:02:35

the short answer is no, because reagent (and I think fulcro + rum) all have their own way of defining components that aren't actually React Component classes until you render them

john23:02:30

hmm. So, there's reagent.core/adapt-react-class and I'd like to pre-adapt the react class first, with my-lib/my-adapt-react-class. After I've done my business with it, I'll send it on to reagent.core/adapt-react-class.

john23:02:02

I think I have a plan for reagent.core/create-class, which just takes a map. I'll provide my/create-class which takes whatever map you give it and, if you already have a fn in :component-did-mount, I'll just wrap the fn and put the wrapped fn back on the map, then pass it on to reagent.core/create-class.

john23:02:21

But I'd like to be able to do that for generic react component js objects