UNPKG

generator-steroids

Version:
35 lines (19 loc) 812 B
<script> steroids.view.navigationBar.show("Preload Example"); // Listen for window.postMessage() messages that the preloaded webview sends us window.addEventListener("message", function(msg) { var elem = document.querySelector("#preloadStatus"); elem.textContent = "preloaded for " + msg.data.uptime + " seconds"; }); // Initialize and preload the view var showView = new steroids.views.WebView("/views/preloadExample/show.html"); showView.preload(); // Helper functions function openShow() { steroids.layers.push(showView); } </script> <div class="content-padded"> <div class="topcoat-button--cta center full" ontouchend="openShow()">Open preloaded WebView</div> <p>Preload status: <span id="preloadStatus">Not yet preloaded, preloading...</span></p> </div>