| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria ([email protected]) |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.JavaScriptCore.Objects.Class
Contents
Description
No description available in the introspection data.
Synopsis
- newtype Class = Class (ManagedPtr Class)
- class (GObject o, IsDescendantOf Class o) => IsClass o
- toClass :: (MonadIO m, IsClass o) => o -> m Class
- noClass :: Maybe Class
- classAddConstructor :: (HasCallStack, MonadIO m, IsClass a) => a -> Maybe Text -> Callback -> GType -> Maybe [GType] -> m Value
- classAddConstructorVariadic :: (HasCallStack, MonadIO m, IsClass a) => a -> Maybe Text -> Callback -> GType -> m Value
- classAddMethod :: (HasCallStack, MonadIO m, IsClass a) => a -> Text -> Callback -> GType -> Maybe [GType] -> m ()
- classAddMethodVariadic :: (HasCallStack, MonadIO m, IsClass a) => a -> Text -> Callback -> GType -> m ()
- classAddProperty :: (HasCallStack, MonadIO m, IsClass a) => a -> Text -> GType -> Maybe Callback -> Maybe Callback -> m ()
- classGetName :: (HasCallStack, MonadIO m, IsClass a) => a -> m Text
- classGetParent :: (HasCallStack, MonadIO m, IsClass a) => a -> m Class
- constructClassContext :: (IsClass o, IsContext a) => a -> IO (GValueConstruct o)
- getClassContext :: (MonadIO m, IsClass o) => o -> m (Maybe Context)
- constructClassName :: IsClass o => Text -> IO (GValueConstruct o)
- getClassName :: (MonadIO m, IsClass o) => o -> m Text
- constructClassParent :: (IsClass o, IsClass a) => a -> IO (GValueConstruct o)
- getClassParent :: (MonadIO m, IsClass o) => o -> m Class
Exported types
Memory-managed wrapper type.
Instances
| GObject Class Source # | |
Defined in GI.JavaScriptCore.Objects.Class Methods gobjectType :: IO GType | |
| HasParentTypes Class Source # | |
Defined in GI.JavaScriptCore.Objects.Class | |
| type ParentTypes Class Source # | |
Defined in GI.JavaScriptCore.Objects.Class | |
class (GObject o, IsDescendantOf Class o) => IsClass o Source #
Instances
| (GObject o, IsDescendantOf Class o) => IsClass o Source # | |
Defined in GI.JavaScriptCore.Objects.Class | |
Methods
addConstructor
Arguments
| :: (HasCallStack, MonadIO m, IsClass a) | |
| => a |
|
| -> Maybe Text |
|
| -> Callback |
|
| -> GType |
|
| -> Maybe [GType] |
|
| -> m Value | Returns: a |
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 |
|
| -> Maybe Text |
|
| -> Callback |
|
| -> GType |
|
| -> m Value | Returns: a |
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 Value<!-- -->s 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
Arguments
| :: (HasCallStack, MonadIO m, IsClass a) | |
| => a |
|
| -> Text |
|
| -> Callback |
|
| -> GType |
|
| -> Maybe [GType] |
|
| -> 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 |
|
| -> Text |
|
| -> Callback |
|
| -> GType |
|
| -> 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 Value<!-- -->s
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
Arguments
| :: (HasCallStack, MonadIO m, IsClass a) | |
| => a |
|
| -> Text |
|
| -> GType |
|
| -> Maybe Callback |
|
| -> Maybe Callback |
|
| -> 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
Arguments
| :: (HasCallStack, MonadIO m, IsClass a) | |
| => a |
|
| -> m Text | Returns: the name of |
Get the class name of jscClass
getParent
Arguments
| :: (HasCallStack, MonadIO m, IsClass a) | |
| => a |
|
| -> m Class | Returns: the parent class of |
Get the parent class of jscClass
Properties
context
The Context in which the class was registered.
constructClassContext :: (IsClass o, IsContext a) => a -> IO (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “context” property. This is rarely needed directly, but it is used by new.
getClassContext :: (MonadIO m, IsClass o) => o -> m (Maybe Context) Source #
Get the value of the “context” property.
When overloading is enabled, this is equivalent to
get class #context
name
The name of the class.
constructClassName :: IsClass o => Text -> IO (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, IsClass a) => a -> IO (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