Description Usage Arguments Details Value
Insert input as raw javascript
1 | insert_javascript(string)
|
string |
a string to be interpreted as javascript code |
As much as possible, the jaysire package has been designed to
allow the user to write a behavioural experiment from R that runs through
the browser using the jsPsych javascript library, with no need to write
any javascript code. However, in some cases this will not be possible and
the user may need to pass raw javascript code to the experiment (e.g., when
specifying an "on_finish" callback function). To do so, the javascript should
be specified as a string
that is passed to insert_javascript()
.
What this does is assign the string to the S3 class "json", which in turn
means that it will be written to the "experiment.js" file as is.
An object of class "json"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.