Skip to content

Commit

Permalink
Fix some javascript calls
Browse files Browse the repository at this point in the history
  • Loading branch information
kblok committed Apr 21, 2023
1 parent ac970b9 commit 294c525
Showing 1 changed file with 40 additions and 40 deletions.
80 changes: 40 additions & 40 deletions lib/PuppeteerSharp/WaitTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,50 +100,50 @@ internal async Task Rerun()
_poller = _polling switch
{
WaitForFunctionPollingOption.Raf => await _isolatedWorld.EvaluateFunctionHandleAsync(
@"
({RAFPoller, createFunction}, fn, ...args) => {
const fun = createFunction(fn);
return new RAFPoller(() => {
return fun(...args);
});
}",
new object[]
{
await _isolatedWorld.GetPuppeteerUtilAsync().ConfigureAwait(false),
_fn,
}.Concat(_args).ToArray()).ConfigureAwait(false),
WaitForFunctionPollingOption.Mutation => await _isolatedWorld.EvaluateFunctionHandleAsync(
@"
({MutationPoller, createFunction}, root, fn, ...args) => {
const fun = createFunction(fn);
return new MutationPoller(() => {
@"
({RAFPoller, createFunction}, fn, ...args) => {
const fun = createFunction(fn);
return new RAFPoller(() => {
return fun(...args);
}, root || document);
}",
new object[]
{
await _isolatedWorld.GetPuppeteerUtilAsync().ConfigureAwait(false),
_root,
_fn,
}.Concat(_args).ToArray()).ConfigureAwait(false),
});
}",
new object[]
{
await _isolatedWorld.GetPuppeteerUtilAsync().ConfigureAwait(false),
_fn,
}.Concat(_args).ToArray()).ConfigureAwait(false),
WaitForFunctionPollingOption.Mutation => await _isolatedWorld.EvaluateFunctionHandleAsync(
@"
({MutationPoller, createFunction}, root, fn, ...args) => {
const fun = createFunction(fn);
return new MutationPoller(() => {
return fun(...args);
}, root || document);
}",
new object[]
{
await _isolatedWorld.GetPuppeteerUtilAsync().ConfigureAwait(false),
_root,
_fn,
}.Concat(_args).ToArray()).ConfigureAwait(false),
_ => await _isolatedWorld.EvaluateFunctionHandleAsync(
@"
({IntervalPoller, createFunction}, ms, fn, ...args) => {
const fun = createFunction(fn);
return new IntervalPoller(() => {
return fun(...args);
}, ms);
}",
new object[]
{
await _isolatedWorld.GetPuppeteerUtilAsync().ConfigureAwait(false),
_pollingInterval,
_fn,
}.Concat(_args).ToArray()).ConfigureAwait(false),
@"
({IntervalPoller, createFunction}, ms, fn, ...args) => {
const fun = createFunction(fn);
return new IntervalPoller(() => {
return fun(...args);
}, ms);
}",
new object[]
{
await _isolatedWorld.GetPuppeteerUtilAsync().ConfigureAwait(false),
_pollingInterval,
_fn,
}.Concat(_args).ToArray()).ConfigureAwait(false),
};
await _poller.EvaluateFunctionAsync("poller => poller.start();").ConfigureAwait(false);
await _poller.EvaluateFunctionAsync("poller => poller.start()").ConfigureAwait(false);

var success = await _poller.EvaluateFunctionHandleAsync("poller => poller.result();").ConfigureAwait(false);
var success = await _poller.EvaluateFunctionHandleAsync("poller => poller.result()").ConfigureAwait(false);
_result.TrySetResult(success);
await TerminateAsync().ConfigureAwait(false);
}
Expand Down

0 comments on commit 294c525

Please sign in to comment.