Hi, I am trying to find out if apigee allows JS to include/import another JS, ideally, JS that are loaded at Org or Env level as a ResourceFile
Solved! Go to Solution.
Yes, you can! You can reference any resource file, which is either uploaded at Org level or Environment level. You refer the script under <ResourceURL> tag.
Eg. Here you are referring to a resource file named pathSetter.js.
<Javascript name='PathSetterPolicy' timeLimit='200'> <ResourceURL>jsc://pathSetter.js</ResourceURL> </Javascript>
More examples are available here.
If you want to import/include a JS library (like Crypto) in your JavaScript file, then you use the <IncludeURL> tag.
Eg -
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Javascript async="false" continueOnError="false" enabled="true" timeLimit="200" name="JavaScript-1"> <DisplayName>JavaScript 1</DisplayName> <Properties> <Property name="propName">propertyValue</Property> </Properties> <IncludeURL>jsc://javascript-library-file.js</IncludeURL> <ResourceURL>jsc://my-javascript-source-file.js</ResourceURL> </Javascript>
You can use multiple IncludeURL elements. All of the modules specified in "IncludeURL" elements will be concatenated and pre-pended to your source file.
Thanks, Sudhee
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |