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:
Aylur
2023-11-06 00:58:19 +01:00
committed by GitHub
parent 7720f98f1a
commit 11414ffef2
39 changed files with 976 additions and 664 deletions
+27
View File
@@ -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)]
}