Interface ActionReturn<Parameter, Attributes>
interface ActionReturn<Parameter, Attributes> {
$$_attributes?: Attributes;
destroy?: (() => void);
update?: ((parameter: Parameter) => void);
}
$$_attributes?: Attributes;
destroy?: (() => void);
update?: ((parameter: Parameter) => void);
}
Actions can return an object containing the two properties defined in this interface. Both are optional.
ActionReturn
andActionReturn<undefined>
both mean that the action accepts no parameters.Additionally, you can specify which additional attributes and events the action enables on the applied element. This applies to TypeScript typings only and has no effect at runtime.
Example usage:
Docs: https://svelte.dev/docs/svelte-action