Tapatalk

How to call a function in other .js file?

How to call a function in other .js file?

2
NewbieNewbie
2

    May 23, 2007#1

    hi,
    I want to write some common functions into a library file, like 'common.js', how can I call a function in my real .js file? Is there a 'include' statement just like PHP?

    262
    MasterMaster
    262

      May 23, 2007#2

      No, it's not possible at the moment to include common functions as you describe.

      I suggest you send your suggestion for such an enhancement to the scripting support to IDM support ([email protected]).

      "Include" could be either as a command like:
      UltraEdit.include(script path);

      or it could be an option in the Scripting/Scripts... dialogue to specify 1 or more "commons script file" which will be loaded and ready when UE starts.
      (and while we are at it, the same place you should be able to specify an "onLoad" and "onUnload" functions to be invoked when opening and closing a file).

      What do you think ?

      2
      NewbieNewbie
      2

        May 23, 2007#3

        Thank you for your reply. Well, maybe this is the only thing what I can do now, I will send a mail for this suggestion. :D

        1
        NewbieNewbie
        1

          Jun 18, 2007#4

          Great~~

          16
          Basic UserBasic User
          16

            Jun 21, 2007#5

            While any of the above alternatives would be much better, there is one way to do it now if you would really want it. Just create a script, that writes the snippets/function(s) you want. So a script to create a script. when you create a new script, you just run that and your functions are 'included'. Of course when you would update that script, than only scripts made after that would be updated, which makes it bad for code reusability, but it beats retyping common use functions over and over.