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

GI.JavaScriptCore.Objects.Class

Description

No description available in the introspection data.

Synopsis

Exported types

newtype Class Source #

Memory-managed wrapper type.

Constructors

Class (ManagedPtr Class) 

Instances

Instances details
Eq Class Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.Class

Methods

(==) :: Class -> Class -> Bool #

(/=) :: Class -> Class -> Bool #

GObject Class Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.Class

ManagedPtrNewtype Class Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.Class

Methods

toManagedPtr :: Class -> ManagedPtr Class

TypedObject Class Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.Class

Methods

glibType :: IO GType

HasParentTypes Class Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.Class

IsGValue (Maybe Class) Source #

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

Instance details

Defined in GI.JavaScriptCore.Objects.Class

Methods

gvalueGType_ :: IO GType

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

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

type ParentTypes Class Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.Class

type ParentTypes Class = '[Object]

class (GObject o, IsDescendantOf Class o) => IsClass o Source #

Type class for types which can be safely cast to Class, for instance with toClass.

Instances

Instances details
(GObject o, IsDescendantOf Class o) => IsClass o Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.Class

toClass :: (MonadIO m, IsClass o) => o -> m Class Source #

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

Methods

addConstructor

classAddConstructor Source #

Arguments

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

jscClass: a Class

-> Maybe Text

name: the constructor name or Nothing

-> Callback

callback: a Callback to be called to create an instance of jscClass

-> GType

returnType: the GType of the constructor return value

-> Maybe [GType]

parameterTypes: a list of GTypes, one for each parameter, or Nothing

-> m Value

Returns: a Value representing the class constructor.

Add a constructor to jscClass. If name is Nothing, the class name will be used. When <function>new</function> is used with the constructor or jsc_value_constructor_call() is called, callback is invoked receiving the parameters and userData as the last parameter. When the constructor object is cleared in the Class context, destroyNotify is called with userData as parameter.

This function creates the constructor, which needs to be added to an object as a property to be able to use it. Use contextSetValue to make the constructor available in the global object.

Note that the value returned by callback is adopted by jscClass, and the DestroyNotify passed to contextRegisterClass is responsible for disposing of it.

addConstructorVariadic

classAddConstructorVariadic Source #

Arguments

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

jscClass: a Class

-> Maybe Text

name: the constructor name or Nothing

-> Callback

callback: a Callback to be called to create an instance of jscClass

-> GType

returnType: the GType of the constructor return value

-> m Value

Returns: a Value representing the class constructor.

Add a constructor to jscClass. If name is Nothing, the class name will be used. When <function>new</function> is used with the constructor or jsc_value_constructor_call() is called, callback is invoked receiving a PtrArray of Values as arguments and userData as the last parameter. When the constructor object is cleared in the Class context, destroyNotify is called with userData as parameter.

This function creates the constructor, which needs to be added to an object as a property to be able to use it. Use contextSetValue to make the constructor available in the global object.

Note that the value returned by callback is adopted by jscClass, and the DestroyNotify passed to contextRegisterClass is responsible for disposing of it.

addMethod

classAddMethod Source #

Arguments

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

jscClass: a Class

-> Text

name: the method name

-> Callback

callback: a Callback to be called to invoke method name of jscClass

-> GType

returnType: the GType of the method return value, or G_TYPE_NONE if the method is void.

-> Maybe [GType]

parameterTypes: a list of GTypes, one for each parameter, or Nothing

-> m () 

Add method with name to jscClass. When the method is called by JavaScript or jsc_value_object_invoke_method(), callback is called receiving the class instance as first parameter, followed by the method parameters and then userData as last parameter. When the method is cleared in the Class context, destroyNotify is called with userData as parameter.

Note that the value returned by callback must be transfer full. In case of non-refcounted boxed types, you should use G_TYPE_POINTER instead of the actual boxed GType to ensure that the instance owned by Class is used. If you really want to return a new copy of the boxed type, use JSC_TYPE_VALUE and return a Value created with valueNewObject that receives the copy as the instance parameter.

addMethodVariadic

classAddMethodVariadic Source #

Arguments

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

jscClass: a Class

-> Text

name: the method name

-> Callback

callback: a Callback to be called to invoke method name of jscClass

-> GType

returnType: the GType of the method return value, or G_TYPE_NONE if the method is void.

-> m () 

Add method with name to jscClass. When the method is called by JavaScript or jsc_value_object_invoke_method(), callback is called receiving the class instance as first parameter, followed by a PtrArray of Values with the method arguments and then userData as last parameter. When the method is cleared in the Class context, destroyNotify is called with userData as parameter.

Note that the value returned by callback must be transfer full. In case of non-refcounted boxed types, you should use G_TYPE_POINTER instead of the actual boxed GType to ensure that the instance owned by Class is used. If you really want to return a new copy of the boxed type, use JSC_TYPE_VALUE and return a Value created with valueNewObject that receives the copy as the instance parameter.

addProperty

classAddProperty Source #

Arguments

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

jscClass: a Class

-> Text

name: the property name

-> GType

propertyType: the GType of the property value

-> Maybe Callback

getter: a Callback to be called to get the property value

-> Maybe Callback

setter: a Callback to be called to set the property value

-> m () 

Add a property with name to jscClass. When the property value needs to be getted, getter is called receiving the the class instance as first parameter and userData as last parameter. When the property value needs to be set, setter is called receiving the the class instance as first parameter, followed by the value to be set and then userData as the last parameter. When the property is cleared in the Class context, destroyNotify is called with userData as parameter.

Note that the value returned by getter must be transfer full. In case of non-refcounted boxed types, you should use G_TYPE_POINTER instead of the actual boxed GType to ensure that the instance owned by Class is used. If you really want to return a new copy of the boxed type, use JSC_TYPE_VALUE and return a Value created with valueNewObject that receives the copy as the instance parameter.

getName

classGetName Source #

Arguments

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

jscClass: a jSCClass

-> m Text

Returns: the name of jscClass

Get the class name of jscClass

getParent

classGetParent Source #

Arguments

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

jscClass: a jSCClass

-> m Class

Returns: the parent class of jscClass

Get the parent class of jscClass

Properties

context

The Context in which the class was registered.

constructClassContext :: (IsClass o, MonadIO m, IsContext a) => a -> m (GValueConstruct o) Source #

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

name

The name of the class.

constructClassName :: (IsClass o, MonadIO m) => Text -> m (GValueConstruct o) Source #

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

getClassName :: (MonadIO m, IsClass o) => o -> m Text Source #

Get the value of the “name” property. When overloading is enabled, this is equivalent to

get class #name

parent

The parent class or Nothing in case of final classes.

constructClassParent :: (IsClass o, MonadIO m, IsClass a) => a -> m (GValueConstruct o) Source #

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

getClassParent :: (MonadIO m, IsClass o) => o -> m Class Source #

Get the value of the “parent” property. When overloading is enabled, this is equivalent to

get class #parent