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



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 modules into a standalone Gjs app with cgjs that I
linked previously, but not in a GNOME shell extension. For an extension,
you unfortunately would have to set up a bundling process with Webpack,
like https://github.com/dikeert/snap

Popular stuff on npm is MIT/ISC/BSD licensed, so you should generally be
okay as long as you pass copies of every package's exact license to your
users, though it's a good idea to always check COPYING or LICENSE files
in repositories before adding something to your project.

Regex and MarkupParser from GLib won't work because they don't have
constructors compatible with GObject introspection, so only their helper
methods such as escape or match_simple are visible to Gjs.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]