Skip to content

Instantly share code, notes, and snippets.

@ptomato
Last active July 14, 2017 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ptomato/bb496c99631a3f8d57c2174d82a04ecf to your computer and use it in GitHub Desktop.
Save ptomato/bb496c99631a3f8d57c2174d82a04ecf to your computer and use it in GitHub Desktop.
Inventing GObject ES6 Classes (2)
class MyClass extends GObject.Object {
    static get GTypeName { return 'MyNamespaceMyClass'; }
    static get Implements { return [Gio.Initable, MyCustomInterface]; }
    static get Properties {
        return {
            'prop': GObject.ParamSpec.int( /* etc., etc. */ ),
        };
    }
    static get Signals {
        return {
            'signal': { /* etc. */ },
        };
    }
    constructor(props={}) {
        super(props);
        // etc.
    }
get prop() { /* ... */ }
    method(arg) { /* ... */ }
}
GObject.registerClass(MyClass);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment