HeapsIframe is a tiny utility for embedding a compiled Heaps.io JavaScript application inside an <iframe>.
haxelib install heaps-iframeIn a Haxe JS project:
import js.Browser;
import heaps.iframe.HeapsIframe;
class Main {
static function main() {
Browser.window.onload = function () {
HeapsIframe.createHeapsIframe({
// A CSS selector or an Element; defaults to document.body
container: "#root",
// Path to your compiled Heaps JS bundle (relative to the page)
jsUrl: "hello-world.js",
// Optional sizing and styling
width: 800,
height: "600px",
background: "#000"
});
};
}
}This will create an <iframe> inside #root (or document.body if no container is given) and load your Heaps app into it with a WebGL canvas filling the frame.