Remove the Plugin
unmount removes a plugin’s iframe. The element you mounted it on stays.
SportNinja.push(['unmount', '#sportninja']);What You Pass
Section titled “What You Pass”| Argument | Required | What it is |
|---|---|---|
target |
Only with several plugins | The selector or element the plugin was mounted on. With one plugin on the page you can leave it out: SportNinja.push(['unmount']). |
With several plugins on the page, unmount without a target removes nothing and logs a console warning.
Single-Page Apps (React, Vue, etc.)
Section titled “Single-Page Apps (React, Vue, etc.)”- Load
embed.jsand pushinitonce, e.g. in your page template. - Mount when the container element is in the DOM (after render), and unmount before it’s removed, so a later mount on a new element works.
// ReactuseEffect(() => { const element = ref.current; window.SportNinja = window.SportNinja || []; window.SportNinja.push(['mount', element, options]); return () => window.SportNinja.push(['unmount', element]);}, []);- Leave
syncUrlon only if your router doesn’t use the hash; the plugin keeps its page in#sn=….