diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 269ae80..7dfed28 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,7 +35,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Setup Nim - uses: jiro4989/setup-nim-action@v1 + uses: jiro4989/setup-nim-action@v2 with: nim-version: ${{ matrix.nim }} repo-token: ${{ secrets.GITHUB_TOKEN }} @@ -45,18 +45,17 @@ jobs: - name: Generate bindings run: | - nimble install c2nim + nimble install c2nim -y nim scripts/generate_bindings.nims - name: Compile examples run: | - nim c examples/minimal.nim - nim c examples/hello_world.nim - nim c examples/hello_world_c.nim - nim c examples/call_nim_from_js.nim - nim c examples/call_js_from_nim.nim - nim c examples/public_network_access.nim - - nim c examples/serve_folder/serve_folder.nim - nim c examples/qxexample/qxexample.nim - # nim c examples/text_editor/src/text_editor.nim # osfiles/dialog not available in macos + nim c -f examples/minimal.nim + nim c -f examples/hello_world.nim + nim c -f examples/hello_world_c.nim + nim c -f examples/call_nim_from_js.nim + nim c -f examples/call_js_from_nim.nim + nim c -f examples/public_network_access.nim + nim c -f examples/serve_folder/serve_folder.nim + nim c -f examples/qxexample/qxexample.nim + # nim c -f examples/text_editor/src/text_editor.nim # osfiles/dialog not available in macos diff --git a/.gitignore b/.gitignore index bac62a8..0512a96 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ *.exe *.so *.a +.vscode +.vscode/* \ No newline at end of file diff --git a/examples/custom_web_server/main.nim b/examples/custom_web_server/main.nim index 0810ee8..de5d2e0 100644 --- a/examples/custom_web_server/main.nim +++ b/examples/custom_web_server/main.nim @@ -11,13 +11,13 @@ proc main = # there is an event case e.eventType - of weConnected: + of WebuiEvent.weConnected: echo "Connected" - of weDisconnected: + of WebuiEvent.weDisconnected: echo "Disconnected" - of weMouseClick: + of WebuiEvent.weMouseClick: echo "Click" - of weNavigation: + of WebuiEvent.weNavigation: let url = e.getString() echo "Starting navigation to: ", url diff --git a/examples/public_network_access.nim b/examples/public_network_access.nim index c99de63..810918c 100644 --- a/examples/public_network_access.nim +++ b/examples/public_network_access.nim @@ -76,12 +76,12 @@ proc main = # Public Window public_window.public = true # Make URL accessible from public networks public_window.bind("") do (e: Event): # Bind all events - if e.eventType == weConnected: + if e.eventType == WebuiEvent.weConnected: private_window.run("document.getElementById('Logs').value += 'New connection.\\n';") - elif e.eventType == weDisconnected: + elif e.eventType == WebuiEvent.weDisconnected: private_window.run("document.getElementById('Logs').value += 'Disconnected.\\n';") - public_window.show(publicHtml, wbNoBrowser) # Set public window HTML + public_window.show(publicHtml, WebuiBrowser.wbNoBrowser) # Set public window HTML let public_win_url = public_window.url # Get URL of public window # Main Private Window diff --git a/examples/serve_folder/serve_folder.nim b/examples/serve_folder/serve_folder.nim index aedb406..347bae3 100644 --- a/examples/serve_folder/serve_folder.nim +++ b/examples/serve_folder/serve_folder.nim @@ -40,13 +40,13 @@ proc main = # there is an event case e.eventType: - of weConnected: + of WebuiEvent.weConnected: echo "Connected" - of weDisconnected: + of WebuiEvent.weDisconnected: echo "Disconnected" - of weMouseClick: + of WebuiEvent.weMouseClick: echo "Click" - of weNavigation: + of WebuiEvent.weNavigation: echo "Starting navigation to: ", e.getString() else: discard @@ -84,7 +84,7 @@ proc main = window2.bind("Exit", exitApp) # Make Deno as the `.ts` and `.js` interpreter - window.runtime = wrDeno + window.runtime = WebuiRuntime.wrDeno # Set root folder to current directory window.rootFolder = currentSourcePath().parentDir() diff --git a/examples/web_app_multi_client/main.nim b/examples/web_app_multi_client/main.nim index 6e1d6c6..d6da556 100644 --- a/examples/web_app_multi_client/main.nim +++ b/examples/web_app_multi_client/main.nim @@ -35,12 +35,12 @@ proc events(e: Event) = let connectionId = e.connectionId case e.eventType - of weConnected: # New connection + of WebuiEvent.weConnected: # New connection if users_count < (client_id + 1): # +1 because it starts from 0 users_count = client_id + 1 inc tabCount - of weDisconnected: # Disconnection + of WebuiEvent.weDisconnected: # Disconnection if tab_count > 0: dec tab_count else: @@ -73,7 +73,7 @@ proc events(e: Event) = proc main() = # Allow multi-user connection and cookies - setConfig({wcMultiClient, wcUseCookies}, true) + setConfig({WebuiConfig.wcMultiClient, WebuiConfig.wcUseCookies}, true) # Create new window let window = newWindow() diff --git a/webui.nimble b/webui.nimble index 02c39bd..052e1ee 100644 --- a/webui.nimble +++ b/webui.nimble @@ -1,6 +1,6 @@ # Package -version = "2.5.0.1" +version = "2.5.0.2" author = "Jasmine" description = "Wrapper for WebUI" license = "MIT"