Skip to main content
1-Visitor
April 10, 2017
Question

Using JS library in TW

  • April 10, 2017
  • 4 replies
  • 4830 views

Hi,

Can we use third party Javascript library (e.g. jquery-3.2.0.min.js,  jquery.xml2json.js etc.)  in thingworx ? If yes what how to do it ?

If no what is the recommended way to get the those library functions in TW ?

Best Regards,

Aniruddha

    4 replies

    5-Regular Member
    April 11, 2017

    Hello, I found another thread in community talking about "How can I reference my js libraries in custom extension widget", that introduced custom js file into widgets, so that might also give you ideas in how to import your 3rd party library.

    Here's the link for the thread https://community.thingworx.com/thread/39606?&posno=20&q=import%20library&ProductFamily=ThingWorx&source=search

    And if that could help, please keep me notified, thanks!

    avaidya11-VisitorAuthor
    1-Visitor
    April 11, 2017

    Hi

    I want to use custom Javascript file (e.g. my.js) containing utility functions, in 'Snippet' TAB of Thing.services()

    How to do it ?

    Regards,

    Aniruddha

    5-Regular Member
    April 11, 2017

    Hi,

    Remember that the "Scripts" in services or subscriptions are not for client side actions, but for server side actions. We are using "Javascript" syntax and implementation methods, but it's not a real Javascript language for web browsers. If you want to add any snippets or resources in the list of snippets, you need to develop an extension by using "Extension SDK" and create a new JAVA (not Javascript) class for a resource and import into ThingWorx.

    Regards,

    Daniel

    avaidya11-VisitorAuthor
    1-Visitor
    April 13, 2017

    Got it. That Helps !