@sourcesync-sdk/render-activation-web
v0.1.2
Published
This module is designed for rendering activation within web applications. It provides functionalities such as mounting activation components, handling updates, and rendering via different types of renderers.
Downloads
55
Readme
@sourcesync-sdk/render-activation-web
This module is designed for rendering activation within web applications. It provides functionalities such as mounting activation components, handling updates, and rendering via different types of renderers.
Installation
Install the module using npm:
npm install sourcesync-sdk
Or install modules separately:
npm install @sourcesync-sdk/render-activation-web @sourcesync-sdk/app
Usage
import { initializeApp } from 'sourcesync-sdk/app'
import { createActivationView, useSmartblockRenderer } from 'sourcesync-sdk/render-activation-web'
Initialize the app with your app ID:
const app = await initializeApp({
appKey
})
Then call the createActivationView
with an activation object and options specifying the target element and the renderer:
const activationView = createActivationView(app, activation, {
el: '#activation-view',
renderer: useSmartblockRenderer({ /* options */ }) // Or use your custom renderer
});
Mount the view to start interacting with it:
activationView.mount();
Custom Renderers
You can create custom renderers by extending the ActivationBlockRenderer
class and passing it to the ActivationView
options.
API Reference
Classes
ActivationView
: Handles the lifecycle and rendering of activation data.
mount()
: Mount the activation view to the DOM.unmount()
: Clean up the view and remove it from the DOM.updateActivation(activation)
: Update the current activation data.updateContext(context)
: Update the context for the current activation.
License
This SDK is distributed under the Apache License, Version 2.0. The Apache 2.0 License applies to the SDK only and not any other component of the SourceSync Platform.