Files
Aylur 11414ffef2 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
2023-11-06 00:58:19 +01:00

28 lines
680 B
JavaScript

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)]
}