Skip to content

Commit

Permalink
Added type restrictions to method args
Browse files Browse the repository at this point in the history
  • Loading branch information
naqvis committed Feb 18, 2023
1 parent 8b4fd39 commit 52e48e8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: webview
version: 0.2.2
version: 0.2.3

authors:
- Ali Naqvi <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion src/lib.cr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Webview
@[Link("webview")]
# TODO - Windows requires special linker flags for GUI apps, but this doesn't work with crystal stdlib (tried with Crystal 1.6.2).
# @[Link(ldflags: "/subsystem:windows")]
{% else %}
{% else %}
raise "Platform not supported"
{% end %}
lib LibWebView
Expand Down
8 changes: 4 additions & 4 deletions src/webview.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require "json"

# Crystal bindings for [zserge's Webview](https://github.com/zserge/webview) which is an excellent cross-platform single header webview library for C/C++ using Gtk, Cocoa or MSHTML repectively.
module Webview
VERSION = "0.2.2"
VERSION = {{ `shards version "#{__DIR__}"`.chomp.stringify }}

# Window size hints
enum SizeHints
Expand Down Expand Up @@ -118,7 +118,7 @@ module Webview
cb_ctx = Box(BindContext).unbox(data)
res = cb_ctx.cb.call(raw.as_a)
@@bindings.delete(cb_ctx.cb)
LibWebView.webview_return(cb_ctx.w, id, 0, res.to_s)
LibWebView.webview_return(cb_ctx.w, id, 0, res.to_json)
}, boxed)
end

Expand All @@ -128,14 +128,14 @@ module Webview
end
end

def self.window(width, height, hint, title, debug = false)
def self.window(width : Int32, height : Int32, hint : SizeHints, title : String, debug = false)
wv = Webview.new(debug, title)
wv.size(width, height, hint)
wv.title = title
wv
end

def self.window(width, height, hint, title, url, debug = false)
def self.window(width : Int32, height : Int32, hint : SizeHints, title : String, url : String, debug = false)
wv = Webview.new(debug, title)
wv.size(width, height, hint)
wv.title = title
Expand Down

0 comments on commit 52e48e8

Please sign in to comment.