ReadonlyeventsUse this property to subscribe for the different types of events that can occur during push 2 web execution.
Subscribe to error event to be aware if something has happened during the lens push,
with network communication or any other type of error,
event object also contains detailed explanation of the cause.
Use subscriptionChanged event to be aware when subscription state is changed.
Use lensReceived event to be aware when new lens is received from Lens Studio,
also you can get the additional details about the pushed lens.
The extension object must be passed to the Camera Kit object during its bootstrap process. This is a requirement for the proper functioning of push to web functionality.
import { bootstrapCameraKit } from "@snap/camera-kit";
const push2web = new Push2Web();
const extensions = (container) => container.provides(push2Web.extension);
const cameraKit = await bootstrapCameraKit({ apiToken: "token from developer portal" }, extensions);
const cameraKitSession = await cameraKit.createSession();
Initiate subscription for the events from Lens Studio.
After user will be logged in to the web page, using Snapchat account, you can get access token from Login Kit.
Instance of CameraKitSession object form @snap/camera-kit package.
Instance of LensRepository object from @snap/camera-kit package.
Create new instance of Push2Web object, it can be used to start listening for the events, subscribe or unsubscribe for notifications from Lens Studio. Also provides the extension object for the @snap/camera-kit package.