| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Language.Javascript.JSaddle.Evaluate
Description
If you just want to run some JavaScript that you have as a string this is
you can use eval or evaluateScript.
- evaluateScript :: (ToJSString script, MakeObject this, ToJSString url) => script -> this -> url -> Int -> JSM JSVal
- eval :: ToJSString script => script -> JSM JSVal
Documentation
Arguments
| :: (ToJSString script, MakeObject this, ToJSString url) | |
| => script | JavaScript to evaluate |
| -> this | |
| -> url | |
| -> Int | The Line number of the first line of the script |
| -> JSM JSVal |
Evaluates a script (like eval in java script). Unlike eval this function lets you
specify a source URL and starting line number for beter error information.
>>>testJSaddle $ (evaluateScript "\n\n{" global "FileName" 53 >>= valToText) `catch` \(JSException e) -> array (e,e!"sourceURL", e!"line") >>= valToTextSyntaxError: ...,FileName,55
Arguments
| :: ToJSString script | |
| => script | JavaScript to evaluate |
| -> JSM JSVal |
Evaluates a script (like eval in java script)
>>>testJSaddle $ eval "1+1"2