Re: Multiple source files

2018-11-09 Thread makepost
See also https://github.com/makepost/gunit for a test runner, and https://github.com/sammydre/ts-for-gjs for autocomplete and type checking. I actually think it's good not to replicate core Node modules because we have GLib and other introspected GNOME libs with language-independent APIs.

Re: Multiple source files

2018-11-09 Thread makepost
gnome.org/GNOME/gnome-sound-recorder/blob/master/src/org.gnome.SoundRecorder.in https://gitlab.gnome.org/GNOME/gnome-sound-recorder/blob/master/src/main.js Support for ES6 modules and the "import" keyword is in progress, follow along here: https://gitlab.gnome.org/GNOME/gjs/merge_re

Re: Support for auto-completion etc

2018-11-10 Thread makepost
Why Tern specifically? TypeScript compiler checks and autocompletes JavaScript files well too. On 2018-11-10 21:28, Philip Chimento via javascript-list wrote: On Fri, Nov 9, 2018 at 3:20 PM Tony Houghton wrote: Seeing as someone's done most of the hard work already, wouldn't it be fairly sim

Re: Support for auto-completion etc

2018-11-10 Thread makepost
VS Code JavaScript support has been at the level of TypeScript, since last year or so it started using the TS compiler for JS internally. YouCompleteMe deprecated Tern support and is moving to TypeScript as well, see the project's homepage. Try adding this to your tsconfig.json and reload: ``

Re: Subclassing a GObject in Typescript

2018-11-13 Thread makepost
Please consider sending a pull request to ts-for-gjs with definitions and tests for registerClass, if you have time before I can write them. It's a relatively new thing, haven't needed it yet. So far the focus has been on GObject introspection. Definitions for other built-ins, such as package,

Re: Subclassing a GObject in Typescript

2018-11-14 Thread makepost
For methods added by Gjs, like GObject.registerClass, I'd put them into the `patch` map at the end of `main.ts`, where now are substituted lines and comments for clashing and overriden definitions. Basically what you suggest, but keys are more specific like "library.class.method". Or you can ad

Re: Subclassing a GObject in Typescript

2018-11-14 Thread makepost
Meant you could re-use the `patch` map if you wanted when implementing this new functionality, so that most definitions not coming from introspection would stay in one place. Adding _init and symbols is fine I think. Exporting a top-level function from the module should be even easier, the plac

Re: Subclassing a GObject in Typescript

2018-11-16 Thread makepost
A generic seems appropriate, here's how you can start: ```ts export function registerClass(klass: T): T & Partial<{ [interfaces]: any[] [properties]: any [requires]: any[] [signals]: any }>` ``` Best not leave it with `any` but specify what types these properties should have. _init sh

Re: Subclassing a GObject in Typescript

2018-11-19 Thread makepost
You can add multiple signatures per function, following the "Functions" and "Do's and Don'ts" pages of the TypeScript documentation. But as Philip suggests only binding one form, I'd prefer the argument over the decorator, since it's the version already usable in both TypeScript and plain JavaS

Re: Opening up Discourse for language bindings

2019-03-30 Thread makepost
> spend my time logging in to the moderator interface to approve > move that burden to the poster, and that's what requiring an account does. > Approving posts is one thing I'm looking forward to doing much more rarely in > Discourse. Interested why GNOME mailing lists allow non-member postin

Re: GJS : How can I use Regex ( parse HTML ) ?

2019-06-22 Thread makepost
equivalent to public domain. ```js #!/usr/bin/env gjs /** @license 0BSD 2019 makepost */ var Xbel = class { /** @param {string} $x @param {any[]} values */ static Tag($x, values) { const x = ANY({ name: $x.replace(/^<|\s[\s\S]*>$|>$/g, ""), values }

Re: GJS : How can I use Regex ( parse HTML ) ?

2019-06-24 Thread makepost
String.prototype.matchAll appears in Firefox at version 67, so it's not available in stable Gjs 1.50.x that uses SpiderMonkey 52. I think I'd have written just like you did, and presented the user some fallback message if tableOfAnnouncementsHTML is null after the match. You can import npm module

Re: GJS : How can I use Regex ( parse HTML ) ?

2019-06-25 Thread makepost
Keep regular expression in this particular task of yours, but try learning every mentioned approach involving a proper html parser. Npm way using cgjs, and e.g. htmlparser2 or parse5, for a standalone app, with the drawback of fragility. Same but using webpack, for a gnome shell extension, wit

Re: GJS Docs now Hosted on gnome.org

2019-06-25 Thread makepost
On 2019-06-24 21:06, meg ford wrote: https://gjs-docs.gnome.org/ Cool, this one is easy to remember. Might benefit from a shorter gjs.gnome.org alias and sidebar links to examples and the wiki page about Mapping. https://gitlab.gnome.org/GNOME/gjs/tree/master/examples https://gitlab.gnome.or