Skip to content

Instantly share code, notes, and snippets.

@ptomato
Last active July 14, 2017 03:02
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/ebc34ef0c3870d992fd759f88e53f674 to your computer and use it in GitHub Desktop.
Save ptomato/ebc34ef0c3870d992fd759f88e53f674 to your computer and use it in GitHub Desktop.
Inventing GObject ES6 Classes (1)
const MyClass = new Lang.Class({
    Name: 'MyClass',
    GTypeName: 'MyNamespaceMyClass',
    Extends: GObject.Object,
    Implements: [Gio.Initable, MyCustomInterface],
    Properties: {
        'prop': GObject.ParamSpec.int( /* etc., etc. */ ),
    },
    Signals: {
        'signal': { param_types: [ /* etc., etc. */ ] },
    },
    _init(props={}) {
        this.parent(props);
        // etc.
    },
get prop() { /* ... */ },
method(arg) { /* ... */ },
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment