microsoft / ClearScript

A library for adding scripting to .NET applications. Supports V8 (Windows, Linux, macOS) and JScript/VBScript (Windows).
https://microsoft.github.io/ClearScript/
MIT License
1.77k stars 148 forks source link

btoa and atob not defined error #490

Closed dehghani-mehdi closed 1 year ago

dehghani-mehdi commented 1 year ago

I tried to run a script that uses btoa and atob methods, but I got not defined error for this two. I'm using V8 on windows.

Here is my code:

using var engine = new V8ScriptEngine();
engine.Execute(JS CODE);
var result = engine.Script.METHOD(INPUT);
ClearScriptLib commented 1 year ago

Hi @dehghani-mehdi,

Those functions are part of the Web API, typically provided by web browsers, whereas ClearScript provides only the standard set of JavaScript built-ins.

Thanks!

dehghani-mehdi commented 1 year ago

Thank you @ClearScriptLib

Actually, after I posted this issue, I could resolve the issue by adding a custom implementation of these two methods to the main js code.