INTERACTIVE DEMOS
Nothing loaded yet.
Scroll to prove it.
Each demo below is deferred. Just like Boostify works in production — resources load only when needed.
DEMO 01 / 09
onLoad
type="text/boostify" Mark any script tag with type="text/boostify" and call bstf.onload(). Scripts execute after the first user interaction — mousemove, scroll, or touchstart — or after maxTime as a fallback. Zero refactoring. With worker: true, scripts are fetched through Boostify's proxy in a separate thread — your main thread never touches them, so parsing and execution can't block rendering or slow down user interactions.
WITHOUT
<script src="https://www.googletagmanager.com/gtm.js?id=GTM-XXXX"></script>
// ↑ blocks render immediately WITH BOOSTIFY
<script type="text/boostify"
src="https://www.googletagmanager.com/gtm.js?id=GTM-XXXX">
</script>
const bstf = new Boostify({ debug: true });
bstf.onload({ worker: true }); LIVE SANDBOX
Scripts load after the first interaction below — or when maxTime is reached.
Status: waiting for interaction…
// 1. mark scripts for deferral
<script type="text/boostify"
src="https://www.googletagmanager.com/gtm.js?id=GTM-XXXX"></script>
// 2. initialize and call onload
const bstf = new Boostify({ debug: true });
bstf.onload({ worker: true, maxTime: 5000 });
View full documentation →
DEMO 02 / 09
scroll
bstf.scroll() Fires a callback once the user scrolls past a pixel distance from the top of the page. Perfect for libraries that only make sense below the fold — charts, maps, comment threads — where loading at page open wastes bandwidth on users who never scroll that far. Use destroyscroll({ distance }) to cancel the trigger if needed.
WITHOUT
import Chart from 'chart.js/auto';
// ↑ 60KB at page open
// user may never reach the chart WITH BOOSTIFY
bstf.scroll({
distance: 300,
callback: async () => {
const { Chart } = await import('chart.js/auto');
new Chart(canvas, config);
}
}); LIVE SANDBOX
Scroll 300px to trigger — Chart.js loads on demand and renders the chart below.
0 / 300px scrolled
Status: waiting for scroll…
bstf.scroll({
distance: 300,
callback: async () => {
const { Chart } = await import('chart.js/auto');
new Chart(canvas, {
type: 'bar',
data: { labels: ['Jan', 'Feb', 'Mar'], datasets: [{ data: [42, 67, 55] }] },
});
}
});
View full documentation →
DEMO 03 / 09
observer
bstf.observer() Fires a callback when a target element enters the viewport. Perfect for UI components that only make sense when visible — carousels, galleries, maps. CSS and JS load together on demand, so the widget is fully styled when it initialises.
WITHOUT
import { tns } from 'tiny-slider';
import 'tiny-slider/dist/tiny-slider.css';
// ↑ loads at page open
// even if slider is never seen WITH BOOSTIFY
bstf.observer('#slider', async () => {
// loadStyle + loadScript — see Demos 07 & 08
await bstf.loadStyle('tiny-slider.css');
await bstf.loadScript('tiny-slider.js');
tns({ container: '#slider', items: 1 });
}); LIVE SANDBOX
Scroll this section into view — tiny-slider's CSS and JS load on demand, then the carousel initialises.
Status: waiting for viewport entry…
bstf.observer('#slider', async () => {
// loadStyle + loadScript covered in Demos 07 & 08
await bstf.loadStyle('https://cdn.jsdelivr.net/npm/tiny-slider@2/dist/tiny-slider.css');
await bstf.loadScript('https://cdn.jsdelivr.net/npm/tiny-slider@2/dist/min/tiny-slider.js');
tns({ container: '#slider', items: 1, autoplay: true });
});
View full documentation →
DEMO 04 / 09
inactivity
bstf.inactivity() Fires after N milliseconds of no mouse, keyboard, or touch activity. Ideal for showing a promotional offer, newsletter prompt, or contextual ad to users who are clearly reading — not bouncing. Zero wasted impressions on visitors who leave immediately.
WITHOUT
// Ad loads at page open
// shown to everyone — even
// users who bounce in 2s WITH BOOSTIFY
bstf.inactivity(5000, () => {
// user is engaged — show the ad
showPromoPopup();
});
// 0KB until idle signal confirmed LIVE SANDBOX
Stop interacting — go idle for 5 seconds and watch what loads.
Status: move mouse to reset…
Still here? Good.
You're exactly the user
this was built for.
Boostify loads ads, prompts, and widgets only after a user has shown real intent — not on page open. This popup just proved it.
Get started free →bstf.inactivity(5000, () => {
// user has been reading for 5s — they're engaged
showPromoPopup();
}); DEMO 05 / 09
click
bstf.click() Fires a callback when the user clicks a DOM element. Ideal for loading modals, payment SDKs, or request handlers only when there is real intent — not on page open. Zero bytes downloaded until the click happens.
WITHOUT
import modal from 'modal-lib';
// ↑ 45KB loads at page open
// even if user never clicks WITH BOOSTIFY
let modal = null;
bstf.click({
element: document.getElementById('open-modal'),
callback: async () => {
// import runs once — subsequent
// clicks reuse the cached module
modal ??= (await import('./modal-lib.js')).modal;
modal.show();
},
}); LIVE SANDBOX
First click loads the library. Close and reopen as many times as you want — the library is only fetched once.
Status: waiting for click…
Loaded on click ✓
Modal library injected
on demand
This modal didn't exist in the DOM until you clicked. Zero bytes downloaded until you needed it — that's Boostify click deferral.
let modal = null;
bstf.click({
element: document.getElementById('open-modal'),
callback: async () => {
// import() is cached by the browser — runs once
modal ??= (await import('./modal-lib.js')).modal;
modal.show();
},
});
View full documentation →
DEMO 06 / 09
videoEmbed
bstf.videoEmbed() A YouTube or Vimeo iframe weighs ~320KB and fires multiple tracking requests on load. videoEmbed keeps the iframe out of the DOM entirely — but you must pair it with a trigger. Calling it alone fires immediately at page open, same as a plain iframe but with extra JS overhead. Combined with bstf.click(), the full 320KB only transfers when the user actively chooses to play.
WITHOUT
<iframe
src="youtube.com/embed/ID"
width="100%"
height="315">
</iframe>
// ↑ 320KB loads immediately WITH BOOSTIFY
bstf.click({
element: thumbEl,
callback: () => {
bstf.videoEmbed({
url: 'youtube.com/embed/ID',
appendTo: '#player',
autoplay: true,
});
},
});
// 320KB loads on click only LIVE SANDBOX
// ✅ content injection + trigger
bstf.click({
element: document.getElementById('thumb'),
callback: () => {
bstf.videoEmbed({
url: 'https://www.youtube.com/embed/0q6yphdZhUA',
appendTo: '#player',
autoplay: true,
});
},
});
// 0 bytes transferred until the user clicks
View full documentation →
DEMO 07 / 09
videoPlayer
bstf.videoPlayer() Injects a native HTML5 video tag on demand. Unlike an iframe, this gives you full control over the video — ideal for hero videos and self-hosted content. Always pair with a trigger: calling videoPlayer() alone starts the download at page open, same as a plain <video> tag.
WITHOUT
<video autoplay muted loop
src="/videos/bbb.mp4">
</video>
// ↑ 770KB loads at page start WITH BOOSTIFY
bstf.click({
element: thumbEl,
callback: () => {
bstf.videoPlayer({
url: { mp4: '/videos/bbb.mp4' },
attributes: { autoplay: true,
muted: true, loop: true },
appendTo: '#vid',
});
},
});
// download deferred until click LIVE SANDBOX
Click the placeholder to inject the <video> element — file download starts at this moment, not before.
bstf.videoPlayer() called alone downloads the file at page open — same result as a plain <video> tag but with extra runtime overhead. Wrap it in bstf.click() or bstf.observer() so the download only starts when the user chooses to watch.
Click to inject <video> element
Status: waiting for click…
// ✅ content injection + trigger
bstf.click({
element: document.getElementById('thumb'),
callback: () => {
bstf.videoPlayer({
url: { mp4: '/videos/bbb.mp4' },
attributes: { autoplay: true, muted: true, loop: true },
appendTo: '#vid',
});
},
});
// 0 bytes downloaded until the user clicks
View full documentation →
DEMO 08 / 09
loadScript
bstf.loadScript() Appends a script tag to the document on demand. Use this inside any trigger callback to load third-party SDKs — Stripe, Intercom, Segment — only when you actually need them.
WITHOUT
<script src="https://js.stripe.com/v3/"></script>
// 180KB loads on every page
// even on pages without checkout WITH BOOSTIFY
bstf.observer('#checkout', () => {
bstf.loadScript('https://js.stripe.com/v3/');
// SDK loads only when checkout
// section enters the viewport
}); LIVE SANDBOX
bstf.loadScript() called alone injects the <script> at page open — identical to a plain <script src="..."> but with the Boostify runtime on top. Wrapping it in bstf.click(), bstf.observer(), or any trigger is what actually defers the download.
Click to load canvas-confetti via CDN and fire it — in production you'd load Stripe, Intercom, or any SDK on demand.
Status: no script loaded yet…
bstf.observer('#checkout', () => {
bstf.loadScript('https://js.stripe.com/v3/');
// Stripe SDK loads only when checkout is visible
});
View full documentation →
DEMO 09 / 09
loadStyle
bstf.loadStyle() Injects a stylesheet link tag on demand. Useful for loading component-specific CSS only on the pages or interactions that need it — keeping the critical CSS path lean.
WITHOUT
<link rel="stylesheet" href="widget.css">
// 30KB blocks render
// on every page load WITH BOOSTIFY
bstf.observer('#widget', () => {
bstf.loadStyle(
'https://cdn.example.com/widget.css'
);
// CSS loads only when widget
// enters the viewport
}); LIVE SANDBOX
bstf.loadStyle() called alone injects the <link> at page open — identical to <link rel="stylesheet"> but with the Boostify runtime on top. Wrapping it in bstf.observer() or any trigger keeps it off the critical CSS path and defers the download.
Click to inject animate.css from CDN — the box below animates when the stylesheet loads.
Status: no stylesheet loaded…
bstf.observer('#widget', () => {
bstf.loadStyle('https://cdn.example.com/widget.css');
// CSS loads only when widget enters viewport
});
View full documentation →