feat(ags popup window): add onClose method

This commit is contained in:
matt1432 2023-11-14 09:36:39 -05:00
parent 5bde3b8608
commit 4eb9d259cf
2 changed files with 10 additions and 2 deletions

View file

@ -139,6 +139,7 @@ export const PlayerIcon = (player, { symbolic = true, ...props } = {}) => {
} }
else { else {
children.push(Separator(2)); children.push(Separator(2));
// TODO: make this clickable to switch
children.push(Box({ className: 'position-indicator' })); children.push(Box({ className: 'position-indicator' }));
} }
} }

View file

@ -6,8 +6,11 @@ export default ({
// Revealer props // Revealer props
transition = 'slide_down', transition = 'slide_down',
transitionDuration = 500, transitionDuration = 500,
// Optional: execute a function whenever the window pops up
// Optional: execute a function whenever
// the window pops up or goes away
onOpen = () => {}, onOpen = () => {},
onClose = () => {},
// Window props // Window props
name, name,
@ -45,7 +48,11 @@ export default ({
connections: [[App, (rev, currentName, visible) => { connections: [[App, (rev, currentName, visible) => {
if (currentName === name) { if (currentName === name) {
rev.revealChild = visible; rev.revealChild = visible;
onOpen(child);
if (visible)
onOpen(child);
else
onClose(child);
} }
}]], }]],
child: child, child: child,