How to use functions from from js web resource inside a gadget object


I’ve been working on a gadget and I’ve figured out how to use web resources and use js files to store my code.

However I noticed that if I write functions inside the js file then try to call them say in the config or view parts of my gadget object, they can’t be found. I really want the ability to do this as it would mean I don’t have to put all my code in the actual gadget xml page where I do not get syntax highlighting or anything.