mirror of
https://github.com/zoriya/ags.git
synced 2026-06-04 03:06:14 +00:00
refactor how widgets are subclassed (#153)
* rework widget subclassing #121 * remove Utils.connect, add Widget.bind, Widget.connectTo * add: types for on_event fields * bump version to 1.5.1 * export service classes and named instance constants * add starter config example
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { Variable } from 'resource:///com/github/Aylur/ags/variable.js';
|
||||
import { Widget } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
|
||||
const time = new Variable('', {
|
||||
poll: [1000, 'date'],
|
||||
});
|
||||
|
||||
const Bar = (/** @type {number} */ monitor) => Widget.Window({
|
||||
monitor,
|
||||
name: `bar${monitor}`,
|
||||
anchor: ['top', 'left', 'right'],
|
||||
exclusive: true,
|
||||
child: Widget.CenterBox({
|
||||
start_widget: Widget.Label({
|
||||
hpack: 'center',
|
||||
label: 'Welcome to AGS!',
|
||||
}),
|
||||
end_widget: Widget.Label({
|
||||
hpack: 'center',
|
||||
binds: [['label', time]],
|
||||
}),
|
||||
})
|
||||
})
|
||||
|
||||
export default {
|
||||
windows: [Bar(0)]
|
||||
}
|
||||
Reference in New Issue
Block a user