[gnome] Update extensions for version 48
This commit is contained in:
@ -11,12 +11,26 @@ import GObject from 'gi://GObject';
|
||||
/*
|
||||
* Some utility methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* Convert a label from kebab-case to CamelCase.
|
||||
* Will also remove snake_case separators (without capitalizing)
|
||||
*
|
||||
* @param {string} string - The label to reformat
|
||||
* @returns {string} The CamelCased label
|
||||
*/
|
||||
function toDBusCase(string) {
|
||||
return string.replace(/(?:^\w|[A-Z]|\b\w)/g, (ltr, offset) => {
|
||||
return ltr.toUpperCase();
|
||||
}).replace(/[\s_-]+/g, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a label from CamelCase to snake_case.
|
||||
*
|
||||
* @param {string} string - The label to reformat
|
||||
* @returns {string} - The snake_cased label
|
||||
*/
|
||||
function toUnderscoreCase(string) {
|
||||
return string.replace(/(?:^\w|[A-Z]|_|\b\w)/g, (ltr, offset) => {
|
||||
if (ltr === '_')
|
||||
@ -95,7 +109,7 @@ export const Interface = GObject.registerClass({
|
||||
* Invoke an instance's method for a DBus method call.
|
||||
*
|
||||
* @param {Gio.DBusInterfaceInfo} info - The DBus interface
|
||||
* @param {DBus.Interface} iface - The DBus interface
|
||||
* @param {Gio.DBusInterface} iface - The DBus interface
|
||||
* @param {string} name - The DBus method name
|
||||
* @param {GLib.Variant} parameters - The method parameters
|
||||
* @param {Gio.DBusMethodInvocation} invocation - The method invocation info
|
||||
@ -231,7 +245,7 @@ export const Interface = GObject.registerClass({
|
||||
*
|
||||
* @param {Gio.BusType} [busType] - a Gio.BusType constant
|
||||
* @param {Gio.Cancellable} [cancellable] - an optional Gio.Cancellable
|
||||
* @return {Promise<Gio.DBusConnection>} A new DBus connection
|
||||
* @returns {Promise<Gio.DBusConnection>} A new DBus connection
|
||||
*/
|
||||
export function newConnection(busType = Gio.BusType.SESSION, cancellable = null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -252,4 +266,3 @@ export function newConnection(busType = Gio.BusType.SESSION, cancellable = null)
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ const _numberRegex = new RegExp(
|
||||
* the position within @str where the URL was found.
|
||||
*
|
||||
* @param {string} str - the string to search
|
||||
* @return {Object[]} the list of match objects, as described above
|
||||
* @returns {object[]} the list of match objects, as described above
|
||||
*/
|
||||
export function findUrls(str) {
|
||||
_urlRegexp.lastIndex = 0;
|
||||
@ -103,7 +103,7 @@ export function findUrls(str) {
|
||||
*
|
||||
* @param {string} str - The string to be modified
|
||||
* @param {string} [title] - An optional title (eg. alt text, tooltip)
|
||||
* @return {string} the modified text
|
||||
* @returns {string} the modified text
|
||||
*/
|
||||
export function linkify(str, title = null) {
|
||||
const text = GLib.markup_escape_text(str, -1);
|
||||
@ -166,4 +166,3 @@ export default class URI {
|
||||
return this.body ? `${uri}?body=${escape(this.body)}` : uri;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user