... | ... | @@ -48,13 +48,13 @@ if (label.halign === Gtk.Align.CENTER) { |
|
|
}
|
|
|
```
|
|
|
|
|
|
GObject subclasses can define their own properties, which is necessary if you want to use the `GObject.notify()` or `GObject.bind_property()`.
|
|
|
GObject subclasses can define their own properties, which is necessary if you want to use `GObject.notify()` or `GObject.bind_property()`.
|
|
|
|
|
|
```js
|
|
|
var MyLabel = GObject.registerClass({
|
|
|
Properties: {
|
|
|
'example-prop': GObject.ParamSpec.string(
|
|
|
'example-prop', // property name
|
|
|
'example-prop', // property name
|
|
|
'ExampleProperty', // nickname
|
|
|
'An example read write property', // description
|
|
|
GObject.ParamFlags.READWRITE, // READABLE/READWRITE/CONTRUCT/etc
|
... | ... | @@ -76,6 +76,7 @@ var MyLabel = GObject.registerClass({ |
|
|
|
|
|
set example_prop(value) {
|
|
|
this._example_prop = value;
|
|
|
this.notify('example-prop');
|
|
|
}
|
|
|
});
|
|
|
```
|
... | ... | |