siteC

Coast paths

A small guide that changes view without reloading the page.

Running HB Wrapper SPA — destroy, inject, process How this page works ↓
  1. The wrapper loads once in the <head>, the same way as on every site.

    <script async
      src="https://hbw-cdn.hbwrapper.com/hbw.siteC.hbwrapper.com.js"></script>
  2. Before the view changes, collect the slot elements the outgoing route owns.

    var oldAds = [].slice.call(
      view.querySelectorAll('[data-aaad="true"]')
    );
  3. Destroy those slots, write the new markup, then process what the new route brought with it — in that order.

    window.hbw = window.hbw || { cmd: [] };
    window.hbw.cmd.push(function () {
      if (oldAds.length) {
        window.hbw.destroy(oldAds);
      }
      view.innerHTML = html;
      window.hbw.processAdsOnPage();
    });

    destroy() removes the elements as well. Pass false as the second argument to tear down the slots and keep the containers, which is what you want when your framework owns those nodes.

  4. The first render runs the same path. There is nothing to destroy yet, so that step is skipped and the rest is identical.

Auction console: add ?hbwConsole to this URL.

All demo patterns ↗