Scriptable Options
Swiper scriptable options are supported.
Any component property value containing an arrow function () =>
statement will be converted into a JavaScript function.
tip
The converted functions do not support implicit return values. The return
keyword must be used.
The function will have access to all parameters listed in the Swiper documentation.
Global Parameters
In additional to the parameters provided by Swiper, several Perspective specific global objects can be accessed in scriptable options. This global objects are implicitly available and do not need to be specified as function arguments.
self
- A reference to the Perspective component props.
- Allows access to all properties on the Perspective component (i.e.
self.custom.myCustomProperty
).
client
- A reference to the root Perspective client store.
- Allows access to Perspective client properties (i.e.
client.projectName
).
Scriptable Option Example
// Log a message when the slide is changed.
{
"settings": {
"onSlideChange": "() => console.log('slide changed')"
}
}