voces / tstl-jsx

MIT License
3 stars 1 forks source link

How do I use this? #1

Open newobj opened 3 years ago

newobj commented 3 years ago

Does this work, even a little bit? I'm very intrigued. I don't quite understand how to make use of this w/ tstl. Would you be able to provide a hello world of any sort? Thank you!

voces commented 3 years ago

This repo is meant to handle transforming JSX syntax to Lua. It doesn't actually do anything during runtime, though.

For that, you need a pragma (such as React, Preact, etc), which handles creating frames, diffing frames, destroying frames, etc. I built basic-pragma for TSTL, which implements the meta logic like diffing without actually assuming the UI APIs (e.g., browser, WoW, etc) and instead expects an adapter, which handles that bridging.

I built this targeting Warcraft III. My adapter is available at w3ts-jsx. You can find an example project that uses all of this (basic-pragma, tstl-jsx, w3ts-jsx) at w3ts-jsx-example.