Book a Demo

Author Topic: Importing javascript to another  (Read 4890 times)

Gokcen Guner

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Importing javascript to another
« on: August 01, 2013, 12:45:58 am »
Hello, I'm sorry if this is asked before but I couldn't find it on the forums. I'm creating javascript files for different purposes. Time to time I need to re-use a method in another file and copy/paste is not a good option for me. Is there a way that importing/referencing another javascript file from some other else?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Importing javascript to another
« Reply #1 on: August 01, 2013, 01:27:22 am »
You could create a package with re-usable classes. Then set this under package or version control and import it in multiple repositories.


Thought you were talking about RE javascript.

q.
« Last Edit: August 01, 2013, 03:24:35 pm by qwerty »

Gokcen Guner

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: Importing javascript to another
« Reply #2 on: August 01, 2013, 07:16:42 am »
I'm not sure whether I understood you or not. I want a script's method to be used in another, I don't want script walking around in other repositories. Think like Java's syntax 'import' or from C 'include'. Is that possible?

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Importing javascript to another
« Reply #3 on: August 01, 2013, 09:31:26 am »
To include a script library, use the following syntax:
!INC [Script Group Name].[Script Name]

For example:
!INC Local Scripts.EAConstants-JScript

Gokcen Guner

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: Importing javascript to another
« Reply #4 on: August 01, 2013, 06:09:20 pm »
Hello Aaron B,
I've just noticed it and came here to answer my question and saw you answered it, thank you so much :)