Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Loading in libraries in JavaScript

Hi!

Is there a way to load/import in other libraries into the inline_Javascript? I've tried import but that does not work.

I specifically want to include something like DataFrame.js, to create a DataFrame to store previous answers of participants in, such that I can show them to them later.

If there is no way to import libraries in inline_Javascript, is there another way with which I could create a DataFrame-like structure to house certain variables in?

Also sorry for posting two posts in a row, but as they have very different topics I thought people might be able to find them easier depending on their specific struggle!

Kind regards,

Sanne



Comments

  • Hi @Sannee ,

    OSWeb includes a number of JavaScript packages. In principle, you could edit this list and then rebuild OSWeb to include additional packages.

    However, I suspect that this is not what you have in mind, but rather that you would like to import Python libraries in an inline_javascript item. Is that right? If so, then I'm afraid that this is not possible. Usually you can think of a workaround using pure JavaScript though, but of course the details depend on your specific situation!

    — Sebastiaan

  • Hi Sebastiaan!

    I wanted to load in a JavaScript specific library in JavaScript (although DataFrame.js is basically Python's Pandas).

    In the end I did indeed work around it! I just created a big list of lists and looped through that and it worked fine. But good to know for future coding how I can include additional packages!

    Kind regards,

    Sanne

Sign In or Register to comment.