Safe Haskell | None |
---|
Low level JavaScript object property access. In most cases you should use Language.Javascript.JSC.Object instead.
This module is mostly here to implement functions needed to use
JSPropRef
.
- data JSPropRef
- = JSPropRef JSObjectRef JSStringRef
- | JSPropIndexRef JSObjectRef CUInt
- class MakePropRef this where
- makePropRef :: this -> JSC JSPropRef
- objGetPropertyByName :: MakeStringRef name => JSObjectRef -> name -> JSValueRefRef -> JSC JSValueRef
- objGetPropertyAtIndex :: JSObjectRef -> CUInt -> JSValueRefRef -> JSC JSValueRef
- objGetProperty :: JSPropRef -> JSC JSValueRef
- objGetProperty' :: JSPropRef -> JSC (JSObjectRef, JSValueRef)
- objSetPropertyByName :: (MakeStringRef name, MakeValueRef val) => JSObjectRef -> name -> val -> JSPropertyAttributes -> JSValueRefRef -> JSC ()
- objSetPropertyAtIndex :: MakeValueRef val => JSObjectRef -> CUInt -> val -> JSValueRefRef -> JSC ()
- objSetProperty :: MakeValueRef val => JSPropRef -> val -> JSC ()
Propery Reference
data JSPropRef
A reference to a property. Implemented as a reference to an object and something to find the property.
JSPropRef JSObjectRef JSStringRef | Object and property name. |
JSPropIndexRef JSObjectRef CUInt | Object and property index. |
MakePropRef JSPropRef | If we already have a JSPropRef we are fine |
MakeObjectRef JSPropRef | We can use a property as an object. |
MakeArgRefs JSPropRef | We can pass a property as the only paramter to a function. |
MakeValueRef JSPropRef | We can use a property as a value. |
class MakePropRef this where
Anything that can be used to make a JavaScript property reference
makePropRef :: this -> JSC JSPropRef
MakePropRef JSPropRef | If we already have a JSPropRef we are fine |
MakePropRef prop => MakePropRef (JSC prop) | JSPropRef can be made by evaluating a function in |
Getting Property Values
:: MakeStringRef name | |
=> JSObjectRef | object to find the property on. |
-> name | name of the property. |
-> JSValueRefRef | exception if one is raised. |
-> JSC JSValueRef | returns the property value. |
Get a property value given the object and the name of the property.
:: JSObjectRef | object to find the property on. |
-> CUInt | index of the property. |
-> JSValueRefRef | exception if one is raised. |
-> JSC JSValueRef | returns the property value. |
Get a property value given the object and the index of the property.
:: JSPropRef | property reference. |
-> JSC JSValueRef | returns the property value. |
Gets the value of a property given a JSPropRef
.
:: JSPropRef | property reference. |
-> JSC (JSObjectRef, JSValueRef) | returns the object and property value. |
This version of objGetProperty
is handy when you also need to perform.
another operation on the object the property is on.
Setting Property Values
:: (MakeStringRef name, MakeValueRef val) | |
=> JSObjectRef | object to set the property on. |
-> name | name of the property. |
-> val | new value to set the property to. |
-> JSPropertyAttributes | property attributes to give the property. |
-> JSValueRefRef | exception if one is raised. |
-> JSC () |
Set a property value given the object and the name of the property.
:: MakeValueRef val | |
=> JSObjectRef | object to find property on. |
-> CUInt | index of the property. |
-> val | new value to set the property to. |
-> JSValueRefRef | exception if one is raised. |
-> JSC () |
Set a property value given the object and the index of the property.
:: MakeValueRef val | |
=> JSPropRef | property reference. |
-> val | new value to set the property to. |
-> JSC () |
Sets the value of a property given a JSPropRef
.