Skip to content

Async JavascriptBinding - Return null instead of empty object for async Task methods #3980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
amaitland opened this issue Jan 27, 2022 · 0 comments
Assignees
Milestone

Comments

@amaitland
Copy link
Member

For async Task methods (those without a generic return type) the result passed back to Javascript is effectively {}. Rather than creating an unnecessary object as the method didn't return a result I'm changing the behaviour to return null instead.

Technically this is a breaking change as it changes the behaviour, expecected impact on users is extremely low.

public async Task WaitBeforeReturnAsync(int milliseconds)
{
	await Task.Delay(milliseconds);

	Debug.WriteLine("Delayed in ms:" + milliseconds);
}

Technically the Task returns VoidTaskResult which doesn't have any properties.

@amaitland amaitland self-assigned this Jan 27, 2022
@amaitland amaitland added this to the 98.1.x milestone Jan 27, 2022
amaitland added a commit that referenced this issue Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant