Skip to content

Instantly share code, notes, and snippets.

@ptomato
Created July 14, 2017 03:32
Show Gist options
  • Save ptomato/f4609abbfe6ab4bcce790c0b2bde8d09 to your computer and use it in GitHub Desktop.
Save ptomato/f4609abbfe6ab4bcce790c0b2bde8d09 to your computer and use it in GitHub Desktop.
Inventing GObject ES6 Classes (4)
var MyClass = GObject.registerClass({
    GTypeName: 'MyNamespaceMyClass',
    Implements: [Gio.Initable, MyInterface],
    Properties: { 'prop': GObject.ParamSpec.int( /* etc. */ ) },
    Signals: { 'signal': { /* etc. */ } },
}, class MyClass extends GObject.Object {
    constructor(props={}) {
super(props);
// etc.
}
 
    get prop() { /* ... */ }
 
    method(arg) { /* ... */ }
});
var MyInterface = GObject.registerInterface({
    GTypeName: 'MyNamespaceMyInterface',
    Requires: [Gio.Initable],
    Properties: { 'prop': GObject.ParamSpec.int( /* etc. */ ) },
    Signals: { 'signal': { /* etc. */ } },
}, class MyInterface {
    get prop() { /* ... */ }
 
    method(arg) { /* ... */ }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment