Jump to content

importing an external JS file


ftguy2018
 Share

Recommended Posts

Why not separate that code into class/classes in Panda2 instead of copy pasting to the main file? This would keep the code maintainable and should still result in single game.min.js  

If it is some kind of library that is reusable it's better to pack it into a plugin - it seems to be quite simple.

 

Link to comment
Share on other sites

On 11/3/2018 at 6:04 PM, enpu said:

Just create new module and copy paste the content of the JS file into it.

@enpu  I am sorry maybe it is a very simple question but I am not so familiar with the module concept

So let's say if I wanted to add that secure-ls  JS file into a module so it can be called from the game and could access the new secure-ls class and export it in the main game.min

 

https://github.com/softvar/secure-ls/tree/master/dist

 

Where should I copy paste the code, into the file ? anywhere before the module keyword ? into the class , before the body function ? can you please shine some light ? And once again sorry if that question is maybe simple just I want to be sure to do it right.

 

Thank you,

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...