public static JsValue FromString(string value)
{
JsValue reference;
JsErrorCode errorCode;
if (Utils.IsWindows())
{
var stringLength = new UIntPtr((uint)value.Length);
errorCode = NativeMethods.JsPointerToString(value, stringLength, out reference);
}
else
{
var byteCount = new UIntPtr((uint)Encoding.GetEncoding(0).GetByteCount(value));
errorCode = NativeMethods.JsCreateStringUtf8(value, byteCount, out reference);
}
JsErrorHelpers.ThrowIfError(errorCode);
return reference;
}