Using Third Party JavaScript Libraries

Using Third Party JavaScript Libraries

Aras Methods are incredibly flexible. Using the standard IOM and method editor you can accomplish almost anything you set your mind to. If you are struggling to accomplish something with the libraries Aras provides, you can always add your own third party libraries to the code tree. In this post we’ll go over how to add a third party JavaScript library to spice up your client side methods.

Finding a Library

There are thousands of open source JavaScript libraries hosted online for you to use. The most common place to find these libraries would be GitHub. I'd recommend this repository, which has an awesome collection of libraries and resources for you to use.

In this example we’ll go over how to use a popular visualization library, vis.js. You can visit their website here. They also have an active GitHub page where changes are constantly being made. Navigate to either link and download the most recent version of the library. It’s important to note that simply using npm to install the library isn’t enough, as your innovator instance has it’s own collection of libraries it uses. Once you’ve downloaded the zipped folder, unzip it and save it somewhere memorable.

Adding the Library

You’ll need to move that folder to a very specific location within the code tree. Locate your innovator instance. From here you’ll need to go to innovator/Client/Javascript. Paste the folder for your library in this location.

After pasting the new files to this location, you'll need to refresh your client cache before the changes are visible within Innovator. This varies from browser to browser, but in Chrome, CTRL+SHIFT+DELETE will prompt you to clear your client cache.

 

To utilize the library within a method, you’ll need to specify that it is required. This requires a specific statement at the top, which has a path to the required library. Take a look at lines 3-6 in this example from a previous blog post:

 

Once you’ve included the require, you should be able to use functions and types outlined within the library.

Here is a short list of Community Projects which have utilized third party JavaScript libraries:

Final Thoughts

These libraries can make incredibly complex problems easy to handle. The examples I provided all included some visual aspect, as visualizations are complex to create from scratch. If you're looking for some extensions for server side methods, take a look at this blog post about using external DLLs within innovator.