Files
react-native/packages
Pieter De Baets 0e10ee6ac6 Allow AsyncCallback to be used with lambda (#39717)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39717

AsyncCallback is a better abstraction than the current usage of WeakCallbackWrapper and RAIICallbackWrapperDestroyer, and has way fewer gotchas. Making a few changes here to make it easier to use in various scenarios and match the behaviour we're already seeing in CallbackWrapper.

1) Remove the explicit copy constructor, since this prevents an automatic move constructor from being generated
2) Add a call variant which takes a lambda, for callers which need to manually create JSI arguments
3) Ignore AsyncCallback invocations when the underlying runtime has gone away.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D49684248

fbshipit-source-id: 8b49ec22cc409572ead80a85b10a190994bf0dd5
2023-10-03 07:55:17 -07:00
..
2023-10-02 10:28:17 -07:00