Using external javascript

2 replies to this topic
Posted 1+ years ago #1
luggage

Hi There

I need to add some javascript back end functions into my HTML5 game. Currently I create an extern.js, and "import" that. I got that from...

http://www.monkeycoder.co.nz/Community/posts.php?topic=120

That works but the extern.js file is embedded in the main.js file. I really need to keep it seperate as the backend will be maintained by someone else and having it in one massive main.js is more than a little awkward. Is there any way to do that?

Thanks!

 
Posted 1+ years ago #3
luggage

Awesome. I might switch to that then as I ended up with a hacky workaround.

I used the link in my post to generate a set of functions called Extern_Foo. Then all they did was pass through to a function called BackEnd_Foo. BackEnd_Foo were in an external javascript file that's pulled in with the html. Works but seems a bit clumsy.

Thanks!