Quantcast
Channel: PTC Community : Popular Discussions - Integrity
Viewing all articles
Browse latest Browse all 3432

Modular Client Side Triggers

$
0
0

I'm using client side triggers, and I'd like to modularize my js code, but I can't figure out how to include another js file from with in the js file called by the trigger.  For example:

 

File : /Custom/library/ValueAdd.js

<code>

function ValueAdd (key)

{

     var k = key;

 

     var obj =

      {

          getKey : function ()

          {

               return k;

          }

     };

     return obj;

}

</code>

 

File : /Custom/TriggerFile.js

<code>

load("/library/ValueAdd.js"); // Command used by Rhino to load external files, doesn't seem to work here

var va = new ValueAdd("something");

</code>

 

When the map a trigger to the TriggerFile.js and the trigger is executed, I get an error "load is not defined".  It's possible that I have the path to the file wrong, but it doesn't even get that far.  How do I "import" ValueAdd.js into TriggerFile.js?


Viewing all articles
Browse latest Browse all 3432

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>