## Using JavaScript closures Using JavaScript closures — Creating and invoking closures over JavaScript functions using GClosure |

## Synopsis

    #include <seed/seed.h>

    struct              SeedClosure;
    GClosure *          seed_closure_new                    (SeedContext ctx,
                                                             SeedObject function,
                                                             SeedObject user_data,
                                                             const gchar *description);
    SeedObject          seed_closure_get_callable           (GClosure *c);
    SeedValue           seed_closure_invoke                 (GClosure *closure,
                                                             SeedValue *args,
                                                             guint argc,
                                                             SeedException *exception);
    SeedValue           seed_closure_invoke_with_context    (SeedContext ctx,
                                                             GClosure *closure,
                                                             SeedValue *args,
                                                             guint argc,
                                                             SeedException *exception);
    void                seed_closure_warn_exception         (GClosure *c,
                                                             SeedContext ctx,
                                                             SeedException exception);

## Description

Long description

## Details

### struct SeedClosure

    struct SeedClosure {
      GClosure closure;

      JSObjectRef function;
      JSValueRef user_data;

      GType return_type;
      gchar *description;
    };

### seed_closure_new ()

    GClosure *          seed_closure_new                    (SeedContext ctx,
                                                             SeedObject function,
                                                             SeedObject user_data,
                                                             const gchar *description);

### seed_closure_get_callable ()

    SeedObject          seed_closure_get_callable           (GClosure *c);

### seed_closure_invoke ()

    SeedValue           seed_closure_invoke                 (GClosure *closure,
                                                             SeedValue *args,
                                                             guint argc,
                                                             SeedException *exception);

### seed_closure_invoke_with_context ()

    SeedValue           seed_closure_invoke_with_context    (SeedContext ctx,
                                                             GClosure *closure,
                                                             SeedValue *args,
                                                             guint argc,
                                                             SeedException *exception);

### seed_closure_warn_exception ()

    void                seed_closure_warn_exception         (GClosure *c,
                                                             SeedContext ctx,
                                                             SeedException exception);