I’m working with a html developer who is preparing html side buttons for me, and they want to use the same event listeners they register on their end in javascript to call functions my end, rather than me adding extra eventlisteners to the buttons myself which I was going to do.
In terms of approaching this, should I get hold of their javascript + html and put it all into my project so that their javascript can reference a function in my Needle code in the .ts classes I have somehow or do I need to expose something in the classes I am making for them to hook their code up to?
Either would work.
They can get the engine element context (examples in the scripting docs) and use GameObject.findObjectOfType to get specific components of yours, you can make some static api that they can import and you control the methods (e.g. export functions in your npmdef for them to use) or you can call their global js functions or something else from your components
They are basically a normal npm package. So you can define a entry point / main file (e.g. main.ts), in there you can export one or many functions or types.
E.g
export myFunction()…
Lets say your npmdef/package.json name is robs-package then your js dev can import it like so:
import { myFunction } from “robs-package” in his javascript module
I think there are some examples in the docs or samples. Maybe the html overlay sample uses it, im not 100% sure. The bike repo does it for sure and you have access as far as i know