Skip to content

Commit e41925a

Browse files
committed
[frontend] bump dreamland and fix buttons
1 parent 4449b25 commit e41925a

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

dreamlandjs

frontend/src/Tab.ts renamed to frontend/src/Tab.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { createState } from "dreamland/core";
22
import { StatefulClass } from "./StatefulClass";
33
import { scramjet } from "./main";
4-
import { History, injectHistoryEmulation } from "./history";
4+
import {
5+
addHistoryListeners,
6+
History,
7+
injectHistoryEmulation,
8+
} from "./history";
9+
import { NewTab } from "./pages/NewTab";
510

611
let id = 0;
712
export class Tab extends StatefulClass {
@@ -22,12 +27,15 @@ export class Tab extends StatefulClass {
2227
canGoForward: boolean = false;
2328
canGoBack: boolean = false;
2429

30+
internalpage: HTMLElement | null;
31+
2532
constructor(public url: URL = new URL("puter://newtab")) {
2633
super(createState(Object.create(Tab.prototype)));
2734

2835
this.id = id++;
2936

3037
this.title = null;
38+
this.internalpage = null;
3139

3240
this.history = new History(this);
3341
this.history.push(this.url, undefined);
@@ -41,7 +49,10 @@ export class Tab extends StatefulClass {
4149
this.pos = 0;
4250

4351
const frame = scramjet.createFrame();
44-
injectHistoryEmulation(frame, this);
52+
addHistoryListeners(frame, this);
53+
frame.addEventListener("contextInit", (ctx) => {
54+
injectHistoryEmulation(ctx.client, this);
55+
});
4556

4657
this.frame = frame;
4758
}
@@ -53,8 +64,10 @@ export class Tab extends StatefulClass {
5364
switch (url.host) {
5465
case "newtab":
5566
this.title = "New Tab";
67+
this.internalpage = <NewTab tab={this} />;
5668
}
5769
} else {
70+
this.internalpage = null;
5871
this.frame.go(url);
5972
}
6073
}

0 commit comments

Comments
 (0)