Fork me on GitHub
#hoplon
<
2015-10-19
>
levitanong19:10:53

So i’m trying to create a reusable dialog component, which is tricky. Back in React/om, in the component mount lifecycle method, I’d just attach the element to the document.body. This was necessary to make sure that the dialog would always be at the dom tree root, regardless of where you inserted it. Alas, there are no lifecycle hooks in hoplon (which is a good thing). But I’m not sure what the best way to go about this is. Any suggestions?

alandipert19:10:40

@levitanong: do you want to be able to display multiple dialogs at once?

levitanong19:10:23

@alandipert: generally no. (by the way! thanks for making hoplon and boot. they’re pretty awesome.)

alandipert19:10:34

sure no problem, glad you enjoy!

alandipert19:10:11

i will make a quick example

alandipert20:10:22

i made a flash message like that... instead of the "OK" button making the message disappear, a timeout calls a function that sets the message to nil. the general pattern is you hide a cell in a let and make an api for showing messages, then show the messages using an defelem

levitanong20:10:55

@alandipert: oooh okay! so if I were to separate this out into its own namespace, it would still work because defn (and presumably defelem) are always scoped globally, yes?

alandipert20:10:07

@levitanong: sure, as you saw fit... maybe you want the cell to be public even, you could def it

alandipert20:10:27

in general the idea with hoplon is to define the data that will change over time (cells) and then build actions (functions) and views (defelems) around it

levitanong20:10:01

ok got it! Thanks, @alandipert! 😄

flyboarder21:10:31

this may sound like a silly question, but if I create a hoplon page and it includes a javascript library via a link tag can I use jsinterop on the library it includes?

flyboarder22:10:46

nvm this is an externs issue 😛