GJS Legacy Class Syntax
Prior to the introduction of ES6 classes in GJS 1.50, GJS had its own implementation of classes and interfaces to interact with classes. This was implemented in the imports.lang
module via imports.lang.Class
and imports.lang.Interface
.
const Lang = imports.lang;
var A = new Lang.Class({
Name: 'A',
GTypeName: 'A',
Signals: {},
InternalChildren: [],
Children: [],
Extends: GObject.Object,
_init(a, b) {
this.parent(a, b);
}
});
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
Comparison between legacy and ES6
Implementations
Legacy | ES6 |
1 2 3 4 5 6 7 8 9 |
1 2 3 4 5 6 7 8 9 10 |
Binding
Legacy | ES6 |
1 |
1 |
1 2 3 4 5 |
1 2 3 4 5 |