forked from CringeStudios/gamja
Update webpage title when switching buffer
This commit is contained in:
parent
4a981997f0
commit
cdd2da90a9
@ -196,6 +196,7 @@ export default class App extends Component {
|
|||||||
*/
|
*/
|
||||||
autoOpenURL = null;
|
autoOpenURL = null;
|
||||||
messageNotifications = new Set();
|
messageNotifications = new Set();
|
||||||
|
baseTitle = null;
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
@ -470,6 +471,12 @@ export default class App extends Component {
|
|||||||
if (buf.type === BufferType.NICK && !server.users.has(buf.name)) {
|
if (buf.type === BufferType.NICK && !server.users.has(buf.name)) {
|
||||||
this.whoUserBuffer(buf.name, buf.server);
|
this.whoUserBuffer(buf.name, buf.server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (buf.type !== BufferType.SERVER) {
|
||||||
|
document.title = buf.name + ' · ' + this.baseTitle;
|
||||||
|
} else {
|
||||||
|
document.title = this.baseTitle;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1666,9 +1673,14 @@ export default class App extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
this.baseTitle = document.title;
|
||||||
setupKeybindings(this);
|
setupKeybindings(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
document.title = this.baseTitle;
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.state.loading) {
|
if (this.state.loading) {
|
||||||
return html`<section id="connect"></section>`;
|
return html`<section id="connect"></section>`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user