Plugin reference
Plugin config.js settings
| Config | type | Description |
|---|---|---|
| id | string | The plugin ID |
| name | string | Shows when user selects a plugin |
| description | string | Shows when user selects a plugin |
| canBeInterrupted | boolean | True if you support interruption in your plugin |
| canInterrupt | boolean | True if you want this plugin be used as interruption in other plugins |
| canBeObserved | boolean | True if you support being observed by your interruptions |
| canObserve | boolean | True if you support observing your parent plugins that you are interrupting |
| storage | array | Config your fields as object with id and name where store in data in this plugin |
| interruptionFields | array | add objects of fields with an id and a name of interruption data for this plugin |
Example:
const config = {
id: "multiple-choice",
name: "Multiple choice",
description: "Pick one of the options",
canBeInterrupted: false,
canInterrupt: true,
canBeObserved: false,
canObserve: true,
storage: [{ id: "video", name: "Video" }],
interruptionFields: [{ id: "timeInVideo", name: "Tijd in video" }],
}
export default config;
Plugin to be interrupted reference
canBeInterruptedto true.- Set the
interruptionFieldsin config. - Create
InterruptFormField.svelte - Register the
InterruptFormField.sveltein theplugin.js - Access the interruptions in
Render.sveltewith:export let interruptions = []; for (let i = 0; i < interruptions.length; i++) { let interruption = interruptions[i]; if (interruption.data. ...) { -
Dispatch interruption in
Render.svelte:dispatch("interrupt", { interruption: interruption }); - Named slot
interruptionto display interruption inRender.svelte.<slot name="interruption" /> - Create an advance function to continue with the plugin after an interruption in
Render.svelteexport function advance() {
Plugin to be observable reference
- Only plugins that can be interrupted can be observed.
canBeObservableto true in the pluginconfig.js- Provide a observe function in
Render.sveltewith:export function observe() { - Dispatch
observeCompleteevent when observing is done.dispatch("observeComplete");