Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
*.exe
*.so
*.a
.vscode
.vscode/*
8 changes: 4 additions & 4 deletions examples/custom_web_server/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions examples/public_network_access.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions examples/serve_folder/serve_folder.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions examples/web_app_multi_client/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion webui.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "2.5.0.1"
version = "2.5.0.2"
author = "Jasmine"
description = "Wrapper for WebUI"
license = "MIT"
Expand Down