BililiveRecorder/BililiveRecorder.Core/Scripting/Runtime/JintFetchSync.cs
2022-05-11 19:08:53 +08:00

31 lines
779 B
C#

using System.Net.Http;
using System.Threading.Tasks;
using Jint;
using Jint.Native;
using Jint.Native.Function;
namespace BililiveRecorder.Core.Scripting.Runtime
{
public class JintFetchSync : FunctionInstance
{
private static readonly JsString functionName = new JsString("fetch");
public JintFetchSync(Engine engine) : base(engine, engine.Realm, functionName)
{
}
protected override JsValue Call(JsValue thisObject, JsValue[] arguments)
{
var (promise, resolve, reject) = this._engine.RegisterPromise();
var task = Task.Run(() =>
{
});
var req = new HttpRequestMessage(HttpMethod.Get, "https://example.com");
return promise;
}
}
}