JSCWeakValue: JavaScriptCore GLib Reference Manual

## JSCWeakValue JSCWeakValue — JavaScript weak value |

## Functions

JSCWeakValue * | jsc_weak_value_new ()
JSCValue * | jsc_weak_value_get_value ()

## Properties

JSCValue * | value | Write / Construct Only

## Signals

void | cleared | Run Last

## Types and Values

struct | JSCWeakValue

## Object Hierarchy

        GObject
        ╰── JSCWeakValue

## Description

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

## Functions

### jsc_weak_value_new ()

    JSCWeakValue *
    jsc_weak_value_new (JSCValue *value);

Create a new JSCWeakValue for the JavaScript value referenced by `value` .

#### Parameters

value | a JSCValue |

#### Returns

a new JSCWeakValue.

[transfer full]

### jsc_weak_value_get_value ()

    JSCValue *
    jsc_weak_value_get_value (JSCWeakValue *weak_value);

Get a JSCValue referencing the JavaScript value of `weak_value` .

#### Parameters

weak_value | a JSCWeakValue |

#### Returns

a new JSCValue or `NULL` if `weak_value` was cleared.

[transfer full]

## Types and Values

### struct JSCWeakValue

    struct JSCWeakValue;

## Property Details

### The `“value”` property

      “value”                    JSCValue *

The JSCValue referencing the JavaScript value.

Flags: Write / Construct Only

## Signal Details

### The `“cleared”` signal

    void
    user_function (JSCWeakValue *weak_value,
                   gpointer      user_data)

This signal is emitted when the JavaScript value is destroyed.

#### Parameters

weak_value | the JSCWeakValue |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

## See Also

JSCValue