wagtail / telepath

A library for exchanging data between Python and JavaScript
https://wagtail.github.io/telepath/
BSD 3-Clause "New" or "Revised" License
143 stars 4 forks source link

Documentation for installing JavaScript package #8

Open kaedroho opened 2 years ago

kaedroho commented 2 years ago

The tutorial seems to assume that you already have the JS library installed since it references window.telepath but it doesn't provide any instructions on how to use the package on the frontend.

gasman commented 2 years ago

The JS library is bundled in the Python package and included on the page as part of the {{ media }} declaration, if I'm not mistaken.

kaedroho commented 2 years ago

Oh, I see! I'm just building it into a React project so I've added the telepath-unpack library directly to our frontend, I assume this isn't a supported use case at the moment? (happy to help make it supported)

gasman commented 2 years ago

It's semi-supported, in the sense of "you can do this, but you'll have to figure out the details based on the reference docs". A how-to page on that subject would be welcome!

I guess a typical non-Django-served app will have all the relevant .js files containing the telepath definitions as part of a fixed webpack bundle (assuming it doesn't need to be extensible in the way the Wagtail admin is), so it won't make use of the mechanism where Django passes a media declaration.