Skip to content

Instantly share code, notes, and snippets.

@ptomato

ptomato/class.js

Created Jul 14, 2017
Embed
What would you like to do?
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