Skip to content

Commit

Permalink
apply entryType to windows webview
Browse files Browse the repository at this point in the history
  • Loading branch information
bung87 committed Aug 16, 2024
1 parent 9a68ead commit 7b29666
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crowngui.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.2.15"
version = "0.2.17"
author = "bung87"
description = "Web Technologies based Crossplatform GUI Framework"
license = "MIT"
Expand Down
6 changes: 5 additions & 1 deletion src/crowngui/platforms/win/webview2/controllers.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ from web_message_received_handler import nil
from com/icorewebview2domcontentloadedeventhandler import nil
import std/[os, atomics,pathnorm,sugar,json]

Check warning on line 10 in src/crowngui/platforms/win/webview2/controllers.nim

View workflow job for this annotation

GitHub Actions / build (windows-latest, devel)

imported and not used: 'atomics' [UnusedImport]

Check warning on line 10 in src/crowngui/platforms/win/webview2/controllers.nim

View workflow job for this annotation

GitHub Actions / build (windows-latest, devel)

imported and not used: 'sugar' [UnusedImport]

Check warning on line 10 in src/crowngui/platforms/win/webview2/controllers.nim

View workflow job for this annotation

GitHub Actions / build (windows-latest, devel)

imported and not used: 'atomics' [UnusedImport]

Check warning on line 10 in src/crowngui/platforms/win/webview2/controllers.nim

View workflow job for this annotation

GitHub Actions / build (windows-latest, devel)

imported and not used: 'sugar' [UnusedImport]
import loader

Check warning on line 11 in src/crowngui/platforms/win/webview2/controllers.nim

View workflow job for this annotation

GitHub Actions / build (windows-latest, devel)

imported and not used: 'loader' [UnusedImport]

Check warning on line 11 in src/crowngui/platforms/win/webview2/controllers.nim

View workflow job for this annotation

GitHub Actions / build (windows-latest, devel)

imported and not used: 'loader' [UnusedImport]
import ../../../types

proc newControllerCompletedHandler*(hwnd: HWND;controller: ptr ICoreWebView2Controller;view: ptr ICoreWebView2; settings: ptr ICoreWebView2Settings): ptr ICoreWebView2CreateCoreWebView2ControllerCompletedHandler =
result = create(type result[])
Expand Down Expand Up @@ -64,7 +65,10 @@ proc newControllerCompletedHandler*(hwnd: HWND;controller: ptr ICoreWebView2Cont
window.chrome.webview.postMessage(arg);
};"""
discard w.priv.view.AddScriptToExecuteOnDocumentCreated(&script, NULL)
discard w.priv.view.Navigate(T(w.url))
if w.entryType == EntryType.html:
discard w.priv.view.NavigateToString(T(w.url))
else:
discard w.priv.view.Navigate(T(w.url))
return S_OK

proc newEnvironmentCompletedHandler*(hwnd: HWND;controllerCompletedHandler: ptr ICoreWebView2CreateCoreWebView2ControllerCompletedHandler): ptr ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler =
Expand Down

0 comments on commit 7b29666

Please sign in to comment.