mirror of
https://git.sr.ht/~emersion/gamja
synced 2025-04-23 12:33:45 -04:00
Update webpage title when switching buffer
This commit is contained in:
parent
4a981997f0
commit
cdd2da90a9
1 changed files with 12 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue