No announcement yet.

How To Use npm Libraries Within EFS Studies

  • Filter
  • Time
  • Show
Clear All
new posts

  • How To Use npm Libraries Within EFS Studies

    Hi, I'm wishing to add some npm libraries to my EFS code to help with some tasks.

    I created a node.js project and added the libraries with npm install ...
    Does anybody know how I can then import the npm library into my EFS study?

    I have tried

    PHP Code:
    import Observable from '...; 
    which gives the error
    import declarations may only appear at top level of a module
    I have also tried

    PHP Code:
    var Observable = require('...'); 
    which gives the error
    require is not defined
    So is using npm libraries even possible within EFS studies? and if so what is the proper way to import the library?


  • #2
    I'm not sure if I understand your question, but I'm going to guess that you have functions that you want to save in a EFS library so that you can call them from an EFS that right? If it is, you could copy the functions into the eSIgnal script editor and save it as a library (.efsLib) in the Interactive Data FunctionLibrary folder. Then declare a global variable as follows:
    var LibEFSAT = addLibrary("EFSATLib.efsLib"); Afterwards you can call your library functions in your EFS as follows: LibEFSAT.positionsFullCallback(); I hope this helps!