설명 없음

WebBridge.cpp 841B

123456789101112131415161718192021222324252627282930313233
  1. #include "pch.h"
  2. #include "WebBridge.h"
  3. using namespace WebViewBridge;
  4. using namespace Platform;
  5. using namespace Windows::UI::Core;
  6. // https://docs.microsoft.com/en-us/windows/uwp/winrt-components/create-a-windows-runtime-component-in-cppwinrt
  7. // https://github.com/microsoft/react-native-windows/blob/0.59-legacy/current/ReactWindows/ReactNativeWebViewBridge/WebViewBridge.cs
  8. // https://github.com/MicrosoftEdge/JSBrowser/blob/master/NativeListener
  9. WebBridge::WebBridge(int64 tag)
  10. {
  11. m_tag = tag;
  12. // Must run on App UI thread
  13. m_dispatcher = Windows::UI::Core::CoreWindow::GetForCurrentThread()->Dispatcher;
  14. }
  15. void WebBridge::PostMessage(int message) {
  16. m_dispatcher->RunAsync(
  17. CoreDispatcherPriority::Normal,
  18. ref new DispatchedHandler([this, message]
  19. {
  20. MessagePostedEvent(message);
  21. }));
  22. }