gi-javascriptcore-4.0.25: JavaScriptCore bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.JavaScriptCore.Objects.WeakValue

Description

JSCWeakValue represents a weak reference to a value in a Context. It can be used to keep a reference to a JavaScript value without protecting it from being garbage collected and without referencing the Context either.

Synopsis

Exported types

newtype WeakValue Source #

Memory-managed wrapper type.

Constructors

WeakValue (ManagedPtr WeakValue) 

Instances

Instances details
Eq WeakValue Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.WeakValue

GObject WeakValue Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.WeakValue

ManagedPtrNewtype WeakValue Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.WeakValue

Methods

toManagedPtr :: WeakValue -> ManagedPtr WeakValue

TypedObject WeakValue Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.WeakValue

Methods

glibType :: IO GType

HasParentTypes WeakValue Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.WeakValue

IsGValue (Maybe WeakValue) Source #

Convert WeakValue to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.JavaScriptCore.Objects.WeakValue

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe WeakValue -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe WeakValue)

type ParentTypes WeakValue Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.WeakValue

type ParentTypes WeakValue = '[Object]

class (GObject o, IsDescendantOf WeakValue o) => IsWeakValue o Source #

Type class for types which can be safely cast to WeakValue, for instance with toWeakValue.

Instances

Instances details
(GObject o, IsDescendantOf WeakValue o) => IsWeakValue o Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.WeakValue

toWeakValue :: (MonadIO m, IsWeakValue o) => o -> m WeakValue Source #

Cast to WeakValue, for types for which this is known to be safe. For general casts, use castTo.

Methods

getValue

weakValueGetValue Source #

Arguments

:: (HasCallStack, MonadIO m, IsWeakValue a) 
=> a

weakValue: a WeakValue

-> m Value

Returns: a new Value or Nothing if weakValue was cleared.

Get a Value referencing the JavaScript value of weakValue.

new

weakValueNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> m WeakValue

Returns: a new WeakValue

Create a new WeakValue for the JavaScript value referenced by value.

Properties

value

The Value referencing the JavaScript value.

constructWeakValueValue :: (IsWeakValue o, MonadIO m, IsValue a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “value” property. This is rarely needed directly, but it is used by new.

Signals

cleared

type WeakValueClearedCallback = IO () Source #

This signal is emitted when the JavaScript value is destroyed.

afterWeakValueCleared :: (IsWeakValue a, MonadIO m) => a -> ((?self :: a) => WeakValueClearedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the cleared signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after weakValue #cleared callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onWeakValueCleared :: (IsWeakValue a, MonadIO m) => a -> ((?self :: a) => WeakValueClearedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the cleared signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on weakValue #cleared callback