How to link js file to template xml file?

I’m developing a blueprint plugin that loads a version of a page’s history into the template xml file. I’ve managed to retrieve the versions using REST API but I’m unsure how to load it into the xml file. Right now, the js file is only linked to the soy template, any changes made would only affect the soy file. Would appreciate any help.