Script

Load external JavaScript files that cannot be imported as a module. Import libraries from a CDN, point to files on your own server or do whatever else you can think of.

JavaScript is executed in the same sandbox as your TakeyMakey code, so any globals that are declared are accessible directly from make. If your import doesn’t load correctly, you may want to use the `setup` field to prepare the import.

Example

{
  type: "script",
  label: "Script",
  value: "https://example.com/your/code.js",
  show: true,
  module: false,
}

Options

Input

Use these options when using the field with take.

label?
string |‌ false
A label describing the purpose of the field. Setting the label to false removes the element, which can be useful when nested as the only child within a `group`.
detail?
string
Additional information about the field, disclosed in a tooltip.
value
string |‌ Array<string>
A URL pointing to an external JavaScript resource, or an array of URLs.
show?
boolean
When true, the import URL will display in the form with a link to view the file.
module?
boolean
When true, the script will be imported as an ECMAScript module, and the module is supplied to make. From v0.12.0, this option is deprecated. Use top-level imports instead.

Data

An script is read-only. When module is set to true, the imported module is passed to make. Otherwise, it is loaded in the sandbox global context and is not present in the data passed to make.