暫無描述

WebBridge.cpp 529B

1234567891011121314151617181920212223242526
  1. #include "pch.h"
  2. #include "WebBridge.h"
  3. using namespace WebViewBridge;
  4. using namespace Platform;
  5. using namespace Windows::UI::Core;
  6. WebBridge::WebBridge(int64 tag)
  7. {
  8. m_tag = tag;
  9. // Must run on App UI thread
  10. m_dispatcher = Windows::UI::Core::CoreWindow::GetForCurrentThread()->Dispatcher;
  11. }
  12. void WebBridge::PostMessage(Platform::String^ message) {
  13. m_dispatcher->RunAsync(
  14. CoreDispatcherPriority::Normal,
  15. ref new DispatchedHandler([this, message]
  16. {
  17. MessagePostedEvent(message);
  18. }));
  19. }