jsc-0.1.1.1: High level interface for webkit-javascriptcore

Safe HaskellNone
LanguageHaskell2010

Language.Javascript.JSC.Evaluate

Description

If you just want to run some JavaScript that you have as a string this is you can use eval or evaluateScript.

Synopsis

Documentation

evaluateScript Source

Arguments

:: (MakeStringRef script, MakeObjectRef this, MakeStringRef url) 
=> script

JavaScript to evaluate

-> this 
-> url 
-> Int

The Line number of the first line of the script

-> JSC JSValueRef 

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.

>>> testJSC $ (evaluateScript "\n\n{" global "FileName" 53 >>= valToText) `catch` \(JSException e) -> array (e,e!"sourceURL", e!"line") >>= valToText
SyntaxError: Expected token '}',FileName,55

eval Source

Arguments

:: MakeStringRef script 
=> script

JavaScript to evaluate

-> JSC JSValueRef 

Evaluates a script (like eval in java script)

>>> testJSC $ eval "1+1"
2