evaluate method

JSValue evaluate(
  1. String script, {
  2. JSObject? thisObject,
  3. String? sourceURL,
  4. int startingLineNumber = 1,
})

Evaluates a string of JavaScript. script (String) A JSString containing the script to evaluate. thisObject (JSObject) The object to use as "this," or NULL to use the global object as "this." sourceURL (String) A JSString containing a URL for the script's source file. This is used by debuggers and when reporting exceptions. Pass NULL if you do not care to include source file information. startingLineNumber (int) An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. The value is one-based, so the first line is line 1 and invalid values are clamped to 1. @result (JSValueRef) The JSValue that results from evaluating script, or NULL if an exception is thrown.

Implementation

JSValue evaluate(
  String script, {
  JSObject? thisObject,
  String? sourceURL,
  int startingLineNumber = 1,
}) {
  return JSValue(
      this,
      JSBase.jSEvaluateScript(
        pointer,
        JSString.fromString(script).pointer,
        thisObject == null ? nullptr : thisObject.pointer,
        sourceURL == null ? nullptr : JSString.fromString(sourceURL).pointer,
        startingLineNumber,
        exception.pointer,
      ));
}