purescript-cookbook icon indicating copy to clipboard operation
purescript-cookbook copied to clipboard

Fix AddRemoveEventListenerJs in TPS

Open milesfrain opened this issue 5 years ago • 4 comments

Can fix by moving index.html content to .purs.

milesfrain avatar Aug 08 '20 21:08 milesfrain

I'm not sure that that would be the best fix. It would increase the complexity of the recipe, and I'm not sure whether that would be worth it. The issue is that the end-user doesn't control what the index.html file is in the iframe. What if that limitation was removed? For example, JsFiddle has HTML, CSS, and JS. Right now, we're only doing the JS side of things. I wouldn't want to support CSS because one can add that via the HTML, but adding the HTML would help.

JordanMartinez avatar Aug 09 '20 14:08 JordanMartinez

That proposal is tracked in https://github.com/purescript/trypurescript/issues/8 But that would take a lot of time and work to set up.

In the meantime we could either:

  • Add PS code to generate the same HTML <body> content. I believe this is possible, although I've never done this outside of a framework. Might be nice to include another recipe just to demonstrate this capability.
  • Flag recipe as unsupported in TPS.
  • Leave the fixme status, and wait for HTML editing in TPS.

milesfrain avatar Aug 09 '20 17:08 milesfrain

Let's leave the fixme status and wait until a fix is applied upstream.

JordanMartinez avatar Aug 09 '20 22:08 JordanMartinez

Add PS code to generate the same HTML

content.

This is looking more within reach. See GroceriesJs in #210 for an example.

milesfrain avatar Aug 14 '20 00:08 milesfrain