app window(each="{windowItem in windows}", router="{parent.router}", window-title="{windowItem.title}", width=640, height=480, x="{windowItem.x}", y="{windowItem.y}", z=0, resizable="true", url="{windowItem.url}") script. const stateRouter = require("../../lib/frontend/riot-state-router"); this.mixin(require("../../lib/frontend/riot-on-child")); this.mixin(require("riot-query").mixin); this.windows = [ { title: "test one", x: 10, y: 10, url: "/" }, { title: "test two", x: 200, y: 200, url: "/" }, { title: "", x: 390, y: 390, url: "/nodes/create" } ] let currentZIndex = 0; let router = stateRouter(); router.get("/", (req, res) => { res.render("sample", { text: "Hello World!" }); }); router.get("/nodes/create", (req, res) => { res.render("node-create"); }); this.router = router; this.onChild("create:window", (window) => { window.on("focused", () => { this.query("window").filter((otherWindow) => { return otherWindow !== window; }).forEach((otherWindow) => { otherWindow.defocus(); }); window.setZIndex(currentZIndex++); }); window.on("requestClose", () => { window.reportClose(); this.windows = this.windows.filter((windowItem) => windowItem !== window._item); this.update(); }); window.focus(); });