window.postMessage
.
Since this package relies on window.postMessage
, it only works in Client Components.
Relevant Packages
@whop/iframe
- The main package for the iframe SDK.@whop/react
- A React wrapper for Whop Apps including helpers for the iframe SDK.
Setup
The main function exported from the@whop/iframe
package is the createSdk
function. When called, this function sets up a listener for messages from the main Whop site, using window.on('message', ...)
. It is also exposed through the WhopIframeSdkProvider
component from @whop/react
.
React
If you’re using React, it is recommended to use theWhopIframeSdkProvider
component from @whop/react
to provide the iframe SDK to all child components.
Other Frameworks
For other frameworks, you can use thecreateSdk
function from @whop/iframe
to create an instance of the iframe SDK.
We have now setup the SDK and iFrame.