Howdy, Stranger!

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

Supported by

How to share functions between inline_javascript

Hello everyone,

I am currently working on an online experiment that includes multiple inline_javascript and many long self-defined functions. I find it really painful to define those functions in every script. I found the 'persistent' object mentioned on the website (https://osdoc.cogsci.nl/3.3/manual/javascript/about/#available-javascript-libraries) which states that functions can be shared across different scripts (you could also see the picture below). However, I didn't find a specific example of how to implement this feature. I tried many times, but it didn't work.

Can anyone teach me how to achieve this functionality? Thank you very much for your help.

Comments

  • Hi @Siyang ,

    Indeed, the lack of a persistent workspace was a serious limitation in OpenSesame 3.3 / OSWeb 1.4. However, in OpenSesame 4.0 / OSWeb 2.0, this has been resolved, so there is no longer a need to use the persistent object or other hacks to share objects across multiple inline_javascript items.

    OpenSesame 4.0 is not officially released yet, but it's already fairly stable, and if you're currently developing a new experiment it's probably worthwhile to do this in 4.0 already.

    — Sebastiaan

  • Hi @sebastiaan,

    Thank you so much for your reply! I will try it with OpenSesame 4.0 / OSWeb 2.0. I will post my subsequent progress. Hope everything goes fine.

    Thanks again.

    Siyang

Sign In or Register to comment.