Custom interfaces can be defined in GJS, although this is rarely done
Interfaces are defined in GJS by inheriting from GObject.Interface
and providing the class definition property Requires
. The general rules for interfaces defined in GJS are:
Custom interfaces can be defined in GJS, although this is rarely done
Interfaces are defined in GJS by inheriting from GObject.Interface
and providing the class definition property Requires
. The general rules for interfaces defined in GJS are:
const Gio = imports.gi.Gio; | |
const GLib = imports.gi.GLib; | |
const ifaceXml = ` | |
<node> | |
<interface name="org.gnome.SettingsDaemon.Smartcard.Token"> | |
<property name="Name" type="s" access="read"/> | |
<property name="Driver" type="o" access="read"/> | |
<property name="IsInserted" type="b" access="read"/> |
Generally speaking, SpiderMonkey implements a mark-and-sweep garbage collector, although it employs a number of strategies including generational collection (with nursery and tenured regions), incremental collection, arena compacting and others.
This a brief overview of the structure of SpiderMonkey garbage collector heaps with some additional notes on GJS particulars. This isn't an exhaustive article on garbage collection or SpiderMonkey internals, only a reasonably thorough
#!/usr/bin/env gjs | |
const GLib = imports.gi.GLib; | |
/** | |
* https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/setInterval | |
* https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/clearInterval | |
*/ | |
window.setInterval = function(func, delay, ...args) { |
#!/usr/bin/env gjs | |
// Make sure we get the right Gtk | |
imports.gi.versions.Gtk = "3.0"; | |
const GObject = imports.gi.GObject; | |
const Gtk = imports.gi.Gtk; | |
const Gio = imports.gi.Gio; | |
const GLib = imports.gi.GLib; | |
'use strict'; | |
const Gio = imports.gi.Gio; | |
const GLib = imports.gi.GLib; | |
async function mount() { | |
try { | |
// This comes from a 'kdeconnect.sftp' packet | |
let file = Gio.File.new_for_uri('sftp://192.168.1.68:1748//storage/emulated/0'); |
"use strict"; | |
// Imports | |
const Lang = imports.lang; | |
const Gio = imports.gi.Gio; | |
const GLib = imports.gi.GLib; | |
const GObject = imports.gi.GObject; | |