Creating JavaScript classes

Creating JavaScript classes — Dealing with Seed class definitions and constructors

Synopsis


#include <seed/seed.h>

enum                SeedPropertyAttributes;
enum                SeedClassAttributes;
typedef             SeedClass;
#define             seed_empty_class
SeedClass           seed_create_class                   (seed_class_definition *def);
SeedObject          seed_make_constructor               (SeedContext ctx,
                                                         SeedClass class,
                                                         SeedObjectCallAsConstructorCallback constructor);

Description

Long description

Details

enum SeedPropertyAttributes

typedef enum
{
  SEED_PROPERTY_ATTRIBUTE_NONE = 0,
  SEED_PROPERTY_ATTRIBUTE_READ_ONLY = 1 << 1,
  SEED_PROPERTY_ATTRIBUTE_DONT_ENUM = 1 << 2,
  SEED_PROPERTY_ATTRIBUTE_DONT_DELETE = 1 << 3
} SeedPropertyAttributes;


enum SeedClassAttributes

typedef enum
{
  SEED_CLASS_ATTRIBUTE_NONE = 0,
  SEED_CLASS_ATTRIBUTE_NO_SHARED_PROTOTYPE = 1 << 1
} SeedClassAttributes;


SeedClass

typedef gpointer SeedClass;


seed_empty_class

#define seed_empty_class { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,};


seed_create_class ()

SeedClass           seed_create_class                   (seed_class_definition *def);

def :

A JSClassDefinition.

Returns :

A SeedClass, described by def.

seed_make_constructor ()

SeedObject          seed_make_constructor               (SeedContext ctx,
                                                         SeedClass class,
                                                         SeedObjectCallAsConstructorCallback constructor);

ctx :

A SeedContext.

class :

A SeedClass to use as the default for constructed objects.

constructor :

The JSObjectCallAsConstructorCallback function to call when the constructor is invoked with 'new'.

Returns :

A SeedObject, which is a constructor function.