API-Version: 1.9

GObject

Base class for webkit/gtk objects, all objects derived from GObject correspond to the original GObjects. They have the same properties, but javascript properties can also be used in camelcase. It is discouraged from settting own properties directly on objects derived from GObject since these objects are shared between all scripts, use script.setPrivate and script.getPrivate instead

new GObject()

Base class for webkit/gtk objects

Properties:
Name Type Description
... Object

Variable number of properties, See the corresponding gtk/webkitgtk/libsoup documentation for a list of properties, All properties can be used in camelcase.

Source:
Example
 
tabs.current["zoom-level"] = 2;
//  is equivalent to 
tabs.current.zoomLevel = 2;

Methods

blockSignal(id)

Blocks emission of a signal

Parameters:
Name Type Description
id Number

The signal id retrieved from GObject#connect

Source:

connect(name, callback, after) → {Number}

Connect to a GObject-signal. Note that all signals are connected using the signal::- or with notify::-prefix. If connecting to a signal the signal::-prefix must be omitted. The callback function will have the same parameters as the GObject signal callback without the first parameter, however some parameters may be undefined if they cannot be converted to javascript objects. All signal handlers are executed after dwb’s default handler.

Parameters:
Name Type Argument Description
name String

The signal name.

callback GObject~connectCallback

Callback that will be called when the signal is emitted.

after Boolean <optional>

Whether to connect after the default signal handler.

Source:
Returns:

The signal id of this signal

Type
Number

connectBlocked(name, callback, after) → {Number}

Connect to a gobject-signal but block the emission of the own callback during execution of the callback. Useful if the object is connected to a notify event and the the property is changed in the callback function.

Parameters:
Name Type Argument Description
name String

The signal name.

callback Function

Callback that will be called when the signal is emitted.

after Boolean <optional>

Whether to connect after the default signal handler.

Source:
Returns:

The signal id of this signal

Type
Number

disconnect(id) → {Boolean}

Disconnects from a signal

Parameters:
Name Type Description
id Number

The signal id retrieved from GObject.connect

Source:
Returns:

Whether a signal was found and disconnected

Type
Boolean

notify(name, callback, after) → {Number}

Connects to a property change notification

Parameters:
Name Type Argument Description
name String

The property name, can also be in camelcase.

callback GObject~notifyCallback

Callback that will be called when the property changes

after Boolean <optional>

Whether to connect after the default handler.

Source:
Returns:

The signal id of this signal

Type
Number

notifyBlocked(name, callback, after) → {Number}

Connects to a property change notification but with signal blocking. Must be used if the property is modified in the callback function.

Parameters:
Name Type Argument Description
name String

The property name, can also be in camelcase.

callback GObject~notifyCallback

Callback that will be called when the property changes

after Boolean <optional>

Whether to connect after the default handler.

Deprecated:
  • Yes
Source:
Returns:

The signal id of this signal

Type
Number
Example
 
gui.statusLabel.notifyBlocked("label", function() {
     this.label += "foo"; 
});

unblockSignal(id)

Unblocks a signal that was blocked with GObject#blockSignal

Parameters:
Name Type Description
id Number

The signal id retrieved from GObject#connect

Source:

Type Definitions

connectCallback(varargs) → {Boolean}

Callback called for GObject signals, this will refer to the object that connected to the signal

Parameters:
Name Type Description
varargs Object

Variable number of additional arguments, see the correspondent gtk/glib/webkit documentation. Note that the first argument is omitted and this will correspond to the first parameter and that only arguments of basic type and arguments derived from GObject are converted to the corresponding javascript object, otherwise the argument will be undefined (e.g. GBoxed types and structs).

Source:
Returns:

Return true to stop the emission. Note that this signal handler is connected after dwb's default handler so it will not prevent dwb's handlers to be executed

Type
Boolean

notifyCallback()

Called when a property of an object changes, this will refer to the object that connected to the signal.

Source: