__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
// SPDX-License-Identifier: MIT OR LGPL-2.0-or-later // SPDX-FileCopyrightText: 2020 Andy Holmes <[email protected]> import GLib from 'gi://GLib'; import Gio from 'gi://Gio'; /* * An XML DBus Interface */ const ifaceXml = ` <node> <interface name="org.gnome.gjs.Test"> <method name="SimpleMethod"/> <method name="ComplexMethod"> <arg type="s" direction="in" name="input"/> <arg type="u" direction="out" name="length"/> </method> <signal name="TestSignal"> <arg name="type" type="s"/> <arg name="value" type="b"/> </signal> <property name="ReadOnlyProperty" type="s" access="read"/> <property name="ReadWriteProperty" type="b" access="readwrite"/> </interface> </node>`; // An example of the service-side implementation of the above interface. class Service { constructor() { this.dbus = Gio.DBusExportedObject.wrapJSObject(ifaceXml, this); } // Properties get ReadOnlyProperty() { return 'a string'; } get ReadWriteProperty() { if (this._readWriteProperty === undefined) return false; return this._readWriteProperty; } set ReadWriteProperty(value) { if (this.ReadWriteProperty !== value) { this._readWriteProperty = value; // Emitting property changes over DBus this.dbus.emit_property_changed( 'ReadWriteProperty', new GLib.Variant('b', value) ); } } // Methods SimpleMethod() { print('SimpleMethod() invoked'); } ComplexMethod(input) { print(`ComplexMethod() invoked with "${input}"`); return input.length; } // Signals emitTestSignal() { this.dbus.emit_signal( 'TestSignal', new GLib.Variant('(sb)', ['string', false]) ); } } // Once you've created an instance of your service, you will want to own a name // on the bus so clients can connect to it. let serviceObj = new Service(); let serviceSignalId = 0; function onBusAcquired(connection, _name) { // At this point you have acquired a connection to the bus, and you should // export your interfaces now. serviceObj.dbus.export(connection, '/org/gnome/gjs/Test'); } function onNameAcquired(_connection, _name) { // Clients will typically start connecting and using your interface now. // Emit the TestSignal every few seconds serviceSignalId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 3, () => { serviceObj.emitTestSignal(); return GLib.SOURCE_CONTINUE; }); } function onNameLost(_connection, _name) { // Clients will know not to call methods on your interface now. Usually this // callback will only be invoked if you try to own a name on DBus that // already has an owner. // Stop emitting the test signal if (serviceSignalId > 0) { GLib.Source.remove(serviceSignalId); serviceSignalId = 0; } } let ownerId = Gio.bus_own_name( Gio.BusType.SESSION, 'org.gnome.gjs.Test', Gio.BusNameOwnerFlags.NONE, onBusAcquired, onNameAcquired, onNameLost ); // Start an event loop let loop = GLib.MainLoop.new(null, false); loop.run(); // Unowning names works just like disconnecting, but note that `onNameLost()` // will not be invoked in this case. Gio.bus_unown_name(ownerId); if (serviceSignalId > 0) { GLib.Source.remove(serviceSignalId); serviceSignalId = 0; }
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| README | File | 80 B | 0644 |
|
| calc.js | File | 3.55 KB | 0644 |
|
| dbus-client.js | File | 4.72 KB | 0644 |
|
| dbus-service.js | File | 3.42 KB | 0644 |
|
| gettext.js | File | 751 B | 0644 |
|
| gio-cat.js | File | 731 B | 0644 |
|
| glistmodel.js | File | 3.69 KB | 0644 |
|
| gtk-application.js | File | 3.64 KB | 0644 |
|
| gtk3-template.js | File | 1.57 KB | 0644 |
|
| gtk3-template.ui | File | 1.61 KB | 0644 |
|
| gtk3.js | File | 2.51 KB | 0644 |
|
| gtk4-frame-clock.js | File | 2.63 KB | 0644 |
|
| gtk4-template.js | File | 1.64 KB | 0644 |
|
| gtk4-template.ui | File | 1.61 KB | 0644 |
|
| gtk4.js | File | 1.87 KB | 0644 |
|
| http-client.js | File | 1.71 KB | 0644 |
|
| http-server.js | File | 1.39 KB | 0644 |
|
| test.jpg | File | 35.55 KB | 0644 |
|
| test.jpg.license | File | 158 B | 0644 |
|
| timers.js | File | 524 B | 0644 |
|
| webkit.js | File | 438 B | 0644 |
|
| websocket-client.js | File | 1.44 KB | 0644 |
|