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
.
Synopsis
- getProp :: JSString -> Object -> JSM JSVal
- unsafeGetProp :: JSString -> Object -> JSM JSVal
- objGetPropertyByName :: ToJSString name => Object -> name -> JSM JSVal
- objGetPropertyAtIndex :: Object -> Int -> JSM JSVal
- setProp :: JSString -> JSVal -> Object -> JSM ()
- unsafeSetProp :: JSString -> JSVal -> Object -> JSM ()
- objSetPropertyByName :: (ToJSString name, ToJSVal val) => Object -> name -> val -> JSM ()
- objSetPropertyAtIndex :: ToJSVal val => Object -> Int -> val -> JSM ()
Getting Property Values
getProp :: JSString -> Object -> JSM JSVal Source #
get a property from an object. If accessing the property results in an exception, the exception is converted to a JSException. Since exception handling code prevents some optimizations in some JS engines, you may want to use unsafeGetProp instead
:: ToJSString name | |
=> Object | object to find the property on. |
-> name | name of the property. |
-> JSM JSVal | returns the property value. |
Get a property value given the object and the name of the property.
objGetPropertyAtIndex Source #
:: Object | object to find the property on. |
-> Int | index of the property. |
-> JSM JSVal | returns the property value. |
Get a property value given the object and the index of the property.
Setting Property Values
:: (ToJSString name, ToJSVal val) | |
=> Object | object to set the property on. |
-> name | name of the property. |
-> val | new value to set the property to. |
-> JSM () |
Set a property value given the object and the name of the property.