Skip to content

Commit

Permalink
Speed up ByondUI mounting (#10427)
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmeow authored Jan 8, 2024
1 parent 2f128b4 commit 2b5449a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tgui/packages/tgui/components/ByondUi.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ const createByondUiElement = (elementId) => {
render: (params) => {
logger.log(`rendering '${id}'`);
byondUiStack[index] = id;
params['is-visible'] = 'true';
Byond.winset(id, params);
Byond.sendMessage('byondui_update', { mounting: true, id: id });
},
unmount: () => {
logger.log(`unmounting '${id}'`);
byondUiStack[index] = null;
Byond.winset(id, {
parent: '',
'is-visible': 'false',
});
Byond.sendMessage('byondui_update', { mounting: false, id: id });
},
Expand All @@ -49,7 +50,7 @@ window.addEventListener('beforeunload', () => {
logger.log(`unmounting '${id}' (beforeunload)`);
byondUiStack[index] = null;
Byond.winset(id, {
parent: '',
'is-visible': 'false',
});
Byond.sendMessage('byondui_update', { mounting: false, id: id });
}
Expand Down

0 comments on commit 2b5449a

Please sign in to comment.