External JS files - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: External JS files (/showthread.php?tid=91620)
External JS files by WARlrus on 07-23-2009 at 05:02 PM
Hi,
I'm trying to tidy up my code a bit. Is there any way to include certain functions within the main JS file of a script?
For instance, with PHP I'd call include("functions.php"); to import functions from that page. Is there an equivalent within JS or the Messenger+ API?
Many thanks,
RE: External JS files by MeEtc on 07-23-2009 at 05:24 PM
All you have to do is place the js files all in the same script folder for them to be loaded. No extra code is necessary.
RE: External JS files by matty on 07-23-2009 at 05:51 PM
http://mpscripts.net/docs/ref-msgplus-loadscriptfile.php
RE: External JS files by Spunky on 07-23-2009 at 06:29 PM
quote: Originally posted by Scripting Docs
Remarks
The use of this function should be weighted carefully. For clarity reasons, all the files of your script should be loaded when the script is started. This function is only meant to be used if parts of your script are optional or don't require to be started immediately. Remember that all the files with a .js extension placed in your main script's directory are always automatically loaded before the script is started.
For security reasons, never use this function to run code you dynamically downloaded from the internet
RE: External JS files by WARlrus on 07-23-2009 at 09:08 PM
Thanks all!
|