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;
|
||||
messageNotifications = new Set();
|
||||
baseTitle = null;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@ -470,6 +471,12 @@ export default class App extends Component {
|
||||
if (buf.type === BufferType.NICK && !server.users.has(buf.name)) {
|
||||
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() {
|
||||
this.baseTitle = document.title;
|
||||
setupKeybindings(this);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
document.title = this.baseTitle;
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.loading) {
|
||||
return html`<section id="connect"></section>`;
|
||||
|
Loading…
x
Reference in New Issue
Block a user