Import

Imports can be used to load external JavaScript. While seemingly simple, this field is one of the most important, giving you access to the entire JavaScript ecosystem. 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 scope 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: "import",
  value: "https://example.com/your/code.js",
  show: true,
  module: false,
})

Options

Input

Use these options when using the field with take.

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 import URL will be imported as an ESM module, and the module is supplied to make.

Data

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