@@ -18,12 +18,9 @@ namespace Babylon
18
18
UrlLib::UrlRequest request;
19
19
request.Open (UrlLib::UrlMethod::Get, url);
20
20
request.ResponseType (UrlLib::UrlResponseType::String);
21
- m_task = arcana::when_all (m_task, request.SendAsync ()).then (arcana::inline_scheduler, arcana::cancellation::none (),
22
- [dispatchFunction = m_dispatchFunction, request = std::move (request), url = std::move (url)](auto ) mutable
23
- {
21
+ m_task = arcana::when_all (m_task, request.SendAsync ()).then (arcana::inline_scheduler, arcana::cancellation::none (), [dispatchFunction = m_dispatchFunction, request = std::move (request), url = std::move (url)](auto ) mutable {
24
22
arcana::task_completion_source<void , std::exception_ptr> taskCompletionSource{};
25
- dispatchFunction ([taskCompletionSource, request = std::move (request), url = std::move (url)](Napi::Env env) mutable
26
- {
23
+ dispatchFunction ([taskCompletionSource, request = std::move (request), url = std::move (url)](Napi::Env env) mutable {
27
24
Napi::Eval (env, request.ResponseString ().data (), url.data ());
28
25
taskCompletionSource.complete ();
29
26
});
@@ -34,31 +31,27 @@ namespace Babylon
34
31
void Eval (std::string source, std::string url)
35
32
{
36
33
m_task = m_task.then (arcana::inline_scheduler, arcana::cancellation::none (),
37
- [dispatchFunction = m_dispatchFunction, source = std::move (source), url = std::move (url)](auto ) mutable
38
- {
39
- arcana::task_completion_source< void , std::exception_ptr> taskCompletionSource{};
40
- dispatchFunction ([taskCompletionSource, source = std::move ( source), url = std::move (url)](Napi::Env env) mutable
41
- {
42
- Napi::Eval (env, source. data (), url. data () );
43
- taskCompletionSource.complete ();
34
+ [dispatchFunction = m_dispatchFunction, source = std::move (source), url = std::move (url)](auto ) mutable {
35
+ arcana::task_completion_source< void , std::exception_ptr> taskCompletionSource{};
36
+ dispatchFunction ([taskCompletionSource, source = std::move (source), url = std::move (url)](Napi::Env env) mutable {
37
+ Napi::Eval (env, source. data ( ), url. data ());
38
+ taskCompletionSource. complete ();
39
+ } );
40
+ return taskCompletionSource.as_task ();
44
41
});
45
- return taskCompletionSource.as_task ();
46
- });
47
42
}
48
43
49
44
void Dispatch (std::function<void (Napi::Env)> callback)
50
45
{
51
46
m_task = m_task.then (arcana::inline_scheduler, arcana::cancellation::none (),
52
- [dispatchFunction = m_dispatchFunction, callback = std::move (callback)](auto ) mutable
53
- {
54
- arcana::task_completion_source< void , std::exception_ptr> taskCompletionSource{};
55
- dispatchFunction ([taskCompletionSource, callback = std::move ( callback)](Napi::Env env) mutable
56
- {
57
- callback (env );
58
- taskCompletionSource.complete ();
47
+ [dispatchFunction = m_dispatchFunction, callback = std::move (callback)](auto ) mutable {
48
+ arcana::task_completion_source< void , std::exception_ptr> taskCompletionSource{};
49
+ dispatchFunction ([taskCompletionSource, callback = std::move (callback)](Napi::Env env) mutable {
50
+ callback ( env);
51
+ taskCompletionSource. complete ();
52
+ } );
53
+ return taskCompletionSource.as_task ();
59
54
});
60
- return taskCompletionSource.as_task ();
61
- });
62
55
}
63
56
64
57
private:
0 commit comments