refactor(ags): change onOpen and onClose to snake_case
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2023-12-31 03:08:48 -05:00
parent 602ee222ec
commit 68beb6118f
2 changed files with 11 additions and 11 deletions

View file

@ -14,8 +14,8 @@ import { timeout } from 'resource:///com/github/Aylur/ags/utils.js';
* @param {WinProp & { * @param {WinProp & {
* transition?: RevProp['transition'] * transition?: RevProp['transition']
* transition_duration?: RevProp['transition_duration'] * transition_duration?: RevProp['transition_duration']
* onOpen?: function * on_open?: function
* onClose?: function * on_close?: function
* blur?: boolean * blur?: boolean
* close_on_unfocus?: 'none'|'stay'|'released'|'clicked' * close_on_unfocus?: 'none'|'stay'|'released'|'clicked'
* }} o * }} o
@ -23,8 +23,8 @@ import { timeout } from 'resource:///com/github/Aylur/ags/utils.js';
export default ({ export default ({
transition = 'slide_down', transition = 'slide_down',
transition_duration = 800, transition_duration = 800,
onOpen = () => {/**/}, on_open = () => {/**/},
onClose = () => {/**/}, on_close = () => {/**/},
// Window props // Window props
name, name,
@ -118,11 +118,11 @@ export default ({
self.reveal_child = isOpen; self.reveal_child = isOpen;
if (isOpen) { if (isOpen) {
onOpen(window); on_open(window);
} }
else { else {
timeout(Number(transition_duration), () => { timeout(Number(transition_duration), () => {
onClose(window); on_close(window);
}); });
} }
} }

View file

@ -30,7 +30,7 @@ const ButtonStates = [];
* @param {{ * @param {{
* command?: function * command?: function
* secondary_command?: function * secondary_command?: function
* onOpen?: function(Revealer):void * on_open?: function(Revealer):void
* icon: string|BindTuple * icon: string|BindTuple
* indicator?: BindTuple * indicator?: BindTuple
* menu?: any * menu?: any
@ -39,7 +39,7 @@ const ButtonStates = [];
const GridButton = ({ const GridButton = ({
command = () => {/**/}, command = () => {/**/},
secondary_command = () => {/**/}, secondary_command = () => {/**/},
onOpen = () => {/**/}, on_open = () => {/**/},
icon, icon,
indicator, indicator,
menu, menu,
@ -168,7 +168,7 @@ const GridButton = ({
if (Activated.value) { if (Activated.value) {
deg = menu ? 360 : 450; deg = menu ? 360 : 450;
onOpen(menu); on_open(menu);
} }
self.setCss(` self.setCss(`
-gtk-icon-transform: rotate(${deg}deg); -gtk-icon-transform: rotate(${deg}deg);
@ -240,7 +240,7 @@ const FirstRow = () => Row({
}], }],
menu: NetworkMenu(), menu: NetworkMenu(),
onOpen: () => Network.wifi.scan(), on_open: () => Network.wifi.scan(),
}), }),
// TODO: do vpn // TODO: do vpn
@ -285,7 +285,7 @@ const FirstRow = () => Row({
}, 'notify::connected-devices'], }, 'notify::connected-devices'],
menu: BluetoothMenu(), menu: BluetoothMenu(),
onOpen: (menu) => { on_open: (menu) => {
execAsync(`bluetoothctl scan ${menu.reveal_child ? execAsync(`bluetoothctl scan ${menu.reveal_child ?
'on' : 'on' :
'off'}`).catch(print); 'off'}`).catch(print);