I’m trying to make a package that, most like atom-html-preview package, it creates a new tab for previewing the text editor. Because it’s a UI generation from XML to HTML there’s a need to process the text from the editor and generate the HTML for previewing.
I initially started to create a http server, generated the view, and loaded an url for previewing in a iframe. I need to say that the preview needs serveral JS to be loaded and the generated file it’s a parameter on the url request. Everything seemed to run OK except that the Atom hanged every time I loaded the url.
An external process worked fine, so, I created a fork process to start the http server on a child process. It sort of worked (some hanging some times).
My final problem is to comunicate with the iframe to reload the file (don’t want to refresh the iframe and load all static files again). So, I wan’t to execute a JS inside the iframe to reload the generated file. So I tested something like:
This executes the reload_file() inside the iframe but also hangs the Atom editor. Again, stuck on hangs …
Any one tried to do something like this? Am I doing this correctly?