• Products
    • Isadora
    • Get It
    • ADD-ONS
    • IzzyCast
    • Get It
  • Forum
  • Help
  • Werkstatt
  • Newsletter
  • Impressum
  • Dsgvo
  • Press
  • Isadora
  • Get It
  • ADD-ONS
  • IzzyCast
  • Get It
  • Press
  • Dsgvo
  • Impressum

Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags

    [ANSWERED] JavaScript Actor - What JavaScript is supported inside the Actor?

    Troubleshooting and Bug Reports
    javascript
    3
    5
    1317
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bslaght last edited by Juriaan

      I'm currently trying to use a JavaScript Actor to pull in some data from an API, but I'm having some issues. I'm getting these errors that the functions Im trying to use are not defined. These are built-in JavaScript functions. For example: date().

      Any help would be greatly appreciated.

      Juriaan 1 Reply Last reply Reply Quote 0
      • Juriaan
        Juriaan Tech Staff @bslaght last edited by

        @bslaght

        Hi there!

        Welcome to the Isadora community forum. Happy to help.

        When I try to use Date.now() for example it returns the correct result. Could you share some code with us?

        Thanks!

        Isadora 3.1.1, Dell XPS 17 9710, Windows 10
        Interactive Performance Designer, Freelance Artist, Scenographer, Lighting Designer, TroikaTronix Community moderator
        Always in for chatting about interaction in space / performance design. Drop me an email at hello@juriaan.me

        B 1 Reply Last reply Reply Quote 0
        • B
          bslaght @Juriaan last edited by

          @juriaan said:

          Date.now()

           Thanks for the quick reply. This is just one example of something I was trying. My goal is to hit a URL with some additional headers and get back some json. Not reflected here, but what I'm working toward.

          function main()
          {

          return fetch('http://api.plos.org/search?q=title:DNA')
          .then(response =>{
              return response.json();
          }).then(data =>{
              console.log(data);
          })

          }

          DusX 1 Reply Last reply Reply Quote 0
          • DusX
            DusX Tech Staff @bslaght last edited by

            @bslaght

            The Javascript engine in the Javascript actor is the google V8 engine. It has all core ecmascript functions, but does not contain any of the DOM related features (these are part of the browser).

            see: https://hackernoon.com/javascr...

            You can use the Get URL Text actor to retrieve a websites text (or data from a REST api) and pass this into javascript for parsing.
            Or you can use TCP IP actors to interact directly with the server. see: https://www.dusxproductions.co...

            You will want to use print(); rather than console.log(); to output message to the Monitor window (the .log is part of the browser as well)

            These articles will be helpful I think:

            https://support.troikatronix.c...
            https://support.troikatronix.c...

            The second one introduces a couple Isadora specific functions for loading external data (or including Libraries.. NOTE libs must be pure Javascript, no DOM etc. Many for Node.JS will work)

            Troikatronix Technical Support

            • New Support Ticket Link: https://support.troikatronix.com/support/tickets/new
            • My Add-ons: https://troikatronix.com/add-ons/?u=dusx
            • Profession Services: https://support.troikatronix.com/support/solutions/articles/13000109444-professional-services

            Running: Win 11 64bit, i7, M.2 PCIe SSD's, 32gb DDR4, nVidia GTX 4070 | located in Ontario Canada.

            B 1 Reply Last reply Reply Quote 0
            • B
              bslaght @DusX last edited by

              @dusx This is amazing and super helpful. Thanks!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post