| 57 | } |
| 58 | |
| 59 | void setupWebView() |
| 60 | { |
| 61 | choc::ui::WebView::Options options; |
| 62 | options.enableDebugMode = true; |
| 63 | options.enableDebugInspector = false; // Set to true to open dev tools |
| 64 | |
| 65 | options.webviewIsReady = [this](choc::ui::WebView& view) |
| 66 | { |
| 67 | std::cout << "WebView is ready, setting up bindings and loading content...\n"; |
| 68 | this->setupJavaScriptBindings (view); |
| 69 | view.navigate ("choc://app/"); |
| 70 | }; |
| 71 | |
| 72 | // Custom resource handler for serving local content |
| 73 | options.fetchResource = [this](const std::string& path) -> choc::ui::WebView::Options::Resource |
| 74 | { |
| 75 | return this->handleResourceRequest (path); |
| 76 | }; |
| 77 | |
| 78 | webView = std::make_unique<choc::ui::WebView>(options); |
| 79 | window.setContent (webView->getViewHandle()); |
| 80 | } |
| 81 | |
| 82 | void setupJavaScriptBindings (choc::ui::WebView& view) |
| 83 | { |
nothing calls this directly
no test coverage detected