mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-12-27 12:35:35 +08:00
31 lines
779 B
C#
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;
|
|
}
|
|
}
|
|
}
|