STEP 3-1Differences between
unmount: Remove a banner
unmount(): voidA method of the object that mount() returns. Removes only the banner shown by that mount(). The element you passed to mount() and its other content stay. The SDK keeps running, and other banners, callbacks, and checkout button handling are not affected.
- When to call: When you discard the element that shows the banner (for example, when the cart drawer closes).
- To shut down the whole SDK, use
destroy(). The differences are shown in the table below.
Exceptions and failures
- Exceptions: None.
- After
destroy(): It does nothing. - After
mount()is called again on the same element: Theunmount()returned by the previousmount()does nothing, and the new banner stays (mount()).
Differences between unmount() and destroy()
| What you call | What is removed | SDK state | When to use it |
|---|---|---|---|
unmount() | That one banner | Keeps running | When closing a drawer, or when only the component that holds the banner is discarded |
destroy() | The whole CheckoutPlusSession (including all banners) | Shut down | When the component that initialized the SDK is discarded, or when recreating the CheckoutPlusSession |
| Nothing | — | Discarded along with the page | When navigating to checkout, or when moving to another page with a full page load |
© Recustomer, Inc.