Fork me on GitHub

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?


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


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


sure no problem, glad you enjoy!


i will make a quick example


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


@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?


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


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


ok got it! Thanks, @alandipert! 😄


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?


nvm this is an externs issue 😛