Brak opisu

App.cpp 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include "pch.h"
  2. #include "App.h"
  3. #include "ReactPackageProvider.h"
  4. #include "winrt/ReactNativeWebView.h"
  5. using namespace winrt::WebViewWindows;
  6. using namespace winrt::WebViewWindows::implementation;
  7. /// <summary>
  8. /// Initializes the singleton application object. This is the first line of
  9. /// authored code executed, and as such is the logical equivalent of main() or
  10. /// WinMain().
  11. /// </summary>
  12. App::App() noexcept
  13. {
  14. MainComponentName(L"example");
  15. #if BUNDLE
  16. JavaScriptBundleFile(L"index.windows");
  17. InstanceSettings().UseWebDebugger(false);
  18. InstanceSettings().UseLiveReload(false);
  19. #else
  20. JavaScriptMainModuleName(L"example/index");
  21. InstanceSettings().UseWebDebugger(true);
  22. InstanceSettings().UseLiveReload(true);
  23. #endif
  24. #if _DEBUG
  25. InstanceSettings().EnableDeveloperMenu(true);
  26. #else
  27. InstanceSettings().EnableDeveloperMenu(false);
  28. #endif
  29. PackageProviders().Append(make<ReactPackageProvider>()); // Includes all modules in this project
  30. PackageProviders().Append(winrt::ReactNativeWebView::ReactPackageProvider());
  31. InitializeComponent();
  32. // This works around a cpp/winrt bug with composable/aggregable types tracked
  33. // by 22116519
  34. AddRef();
  35. m_inner.as<::IUnknown>()->Release();
  36. }