Example #1
0
        public JsValue Parse(string src, JsSourceContext ctx)
        {
            var data = Encoding.UTF8.GetBytes(src);

            Native.ThrowIfError(Native.JsParseModuleSource(this,
                                                           ctx,
                                                           data,
                                                           (uint)data.Length,
                                                           JsParseModuleSourceFlags.DataIsUtf8,
                                                           out var exception));
            return(exception);
        }
Example #2
0
 public JsValue RunScript(string script, byte[] buffer, JsSourceContext sourceContext, string sourceName)
 {
     ThrowIfInvalid();
     Native.ThrowIfError(Native.JsRunSerializedScript(script, buffer, sourceContext, sourceName, out var result));
     return(result);
 }
Example #3
0
 public JsValue ParseScript(string script, JsSourceContext sourceContext, string sourceName)
 {
     ThrowIfInvalid();
     Native.ThrowIfError(Native.JsParseScript(script, sourceContext, sourceName, out var result));
     return(result);
 }