Safe Haskell | None |
---|---|
Language | Haskell2010 |
Low level JavaScript object property access. In most cases you should use Language.Javascript.JSaddle.Object instead.
This module is mostly here to implement functions needed to use
JSPropRef
.
- data JSPropRef
- class MakePropRef this where
- makePropRef :: this -> JSM JSPropRef
- objGetPropertyByName :: MakeStringRef name => JSObjectRef -> name -> JSValueRefRef -> JSM JSValueRef
- objGetPropertyAtIndex :: JSObjectRef -> Index -> JSValueRefRef -> JSM JSValueRef
- objGetProperty :: JSPropRef -> JSM JSValueRef
- objGetProperty' :: JSPropRef -> JSM (JSObjectRef, JSValueRef)
- objSetPropertyByName :: (MakeStringRef name, MakeValueRef val) => JSObjectRef -> name -> val -> JSPropertyAttributes -> JSValueRefRef -> JSM ()
- objSetPropertyAtIndex :: MakeValueRef val => JSObjectRef -> Index -> val -> JSValueRefRef -> JSM ()
- objSetProperty :: MakeValueRef val => JSPropRef -> val -> JSM ()
Propery Reference
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 Index | 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 Source
Anything that can be used to make a JavaScript property reference
makePropRef :: this -> JSM JSPropRef Source
MakePropRef JSPropRef | If we already have a JSPropRef we are fine |
MakePropRef prop => MakePropRef (JSM 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. |
-> JSM 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. |
-> Index | index of the property. |
-> JSValueRefRef | exception if one is raised. |
-> JSM JSValueRef | returns the property value. |
Get a property value given the object and the index of the property.
:: JSPropRef | property reference. |
-> JSM JSValueRef | returns the property value. |
Gets the value of a property given a JSPropRef
.
:: JSPropRef | property reference. |
-> JSM (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. |
-> JSM () |
Set a property value given the object and the name of the property.
:: MakeValueRef val | |
=> JSObjectRef | object to find property on. |
-> Index | index of the property. |
-> val | new value to set the property to. |
-> JSValueRefRef | exception if one is raised. |
-> JSM () |
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. |
-> JSM () |
Sets the value of a property given a JSPropRef
.