Skip to content

Commit 52e48e8

Browse files
committed
Added type restrictions to method args
1 parent 8b4fd39 commit 52e48e8

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

shard.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: webview
2-
version: 0.2.2
2+
version: 0.2.3
33

44
authors:
55
- Ali Naqvi <syed.alinaqvi@gmail.com>

src/lib.cr

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module Webview
99
@[Link("webview")]
1010
# TODO - Windows requires special linker flags for GUI apps, but this doesn't work with crystal stdlib (tried with Crystal 1.6.2).
1111
# @[Link(ldflags: "/subsystem:windows")]
12-
{% else %}
12+
{% else %}
1313
raise "Platform not supported"
1414
{% end %}
1515
lib LibWebView

src/webview.cr

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ require "json"
22

33
# 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.
44
module Webview
5-
VERSION = "0.2.2"
5+
VERSION = {{ `shards version "#{__DIR__}"`.chomp.stringify }}
66

77
# Window size hints
88
enum SizeHints
@@ -118,7 +118,7 @@ module Webview
118118
cb_ctx = Box(BindContext).unbox(data)
119119
res = cb_ctx.cb.call(raw.as_a)
120120
@@bindings.delete(cb_ctx.cb)
121-
LibWebView.webview_return(cb_ctx.w, id, 0, res.to_s)
121+
LibWebView.webview_return(cb_ctx.w, id, 0, res.to_json)
122122
}, boxed)
123123
end
124124

@@ -128,14 +128,14 @@ module Webview
128128
end
129129
end
130130

131-
def self.window(width, height, hint, title, debug = false)
131+
def self.window(width : Int32, height : Int32, hint : SizeHints, title : String, debug = false)
132132
wv = Webview.new(debug, title)
133133
wv.size(width, height, hint)
134134
wv.title = title
135135
wv
136136
end
137137

138-
def self.window(width, height, hint, title, url, debug = false)
138+
def self.window(width : Int32, height : Int32, hint : SizeHints, title : String, url : String, debug = false)
139139
wv = Webview.new(debug, title)
140140
wv.size(width, height, hint)
141141
wv.title = title

0 commit comments

Comments
 (0)