cocoawebview 0.3.15 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/cocoawebview/cocoawebview.m +21 -0
- data/lib/cocoawebview/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cad99e128e05d31cff115cfd0d6fc28baff36d22d9247e5c7b5884b327138a8
|
4
|
+
data.tar.gz: 76bf581086b3728ee51dc4ee80c0313cfb53d25b0c3a960728c95db980817a77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b42b5d66a586af10424ecb0a1ef5db21491a08db9b94a81a113ad9d352cc4b0fbfc801493a14095cab83c3ca17015db681c615f00602a223d7591c21f6235498
|
7
|
+
data.tar.gz: 3c11815ce1c970017adc901344e16b3c06451debf750a1b3ec05ff2ae42995b799a97042d22f9876bd52c3f7a56ed30fc50d167d40acbed18bacd1e5faf7a755
|
@@ -12,6 +12,7 @@ VALUE nsapp_run(VALUE self);
|
|
12
12
|
VALUE nsapp_exit(VALUE self);
|
13
13
|
|
14
14
|
VALUE webview_initialize(VALUE self, VALUE debug, VALUE style, VALUE move_title_buttons, VALUE delta_y);
|
15
|
+
VALUE webview_navigate(VALUE self, VALUE url);
|
15
16
|
VALUE webview_show(VALUE self);
|
16
17
|
VALUE webview_hide(VALUE self);
|
17
18
|
VALUE webview_eval(VALUE self, VALUE code);
|
@@ -127,6 +128,7 @@ VALUE webview_set_bg(VALUE self, VALUE r, VALUE g, VALUE b, VALUE a);
|
|
127
128
|
- (void)setDeltaY:(int)dy;
|
128
129
|
- (id)initWithFrame:(NSRect)frame debug:(BOOL)flag style:(int)style moveTitleButtons:(BOOL)moveTitleButtons deltaY:(int)dy;
|
129
130
|
- (void)eval:(NSString*)code;
|
131
|
+
- (void)navigate:(NSString*)url;
|
130
132
|
- (void)setCocoaWebview:(VALUE)view;
|
131
133
|
- (void)dragging;
|
132
134
|
@end
|
@@ -217,6 +219,12 @@ VALUE webview_set_bg(VALUE self, VALUE r, VALUE g, VALUE b, VALUE a);
|
|
217
219
|
[fileDropView setObj:view];
|
218
220
|
}
|
219
221
|
|
222
|
+
- (void)navigate:(NSString*)url {
|
223
|
+
NSURL *url_ns = [NSURL URLWithString:url];
|
224
|
+
NSURLRequest *request = [NSURLRequest requestWithURL:url_ns];
|
225
|
+
[webView loadRequest:request];
|
226
|
+
}
|
227
|
+
|
220
228
|
- (void)eval:(NSString*)code {
|
221
229
|
[webView evaluateJavaScript:code completionHandler:^(id result, NSError *error) {
|
222
230
|
if (error) {
|
@@ -302,6 +310,7 @@ Init_cocoawebview(void)
|
|
302
310
|
rb_define_method(rb_mCocoaWebviewClass, "show", webview_show, 0);
|
303
311
|
rb_define_method(rb_mCocoaWebviewClass, "hide", webview_hide, 0);
|
304
312
|
rb_define_method(rb_mCocoaWebviewClass, "eval", webview_eval, 1);
|
313
|
+
rb_define_method(rb_mCocoaWebviewClass, "navigate", webview_navigate, 1);
|
305
314
|
rb_define_method(rb_mCocoaWebviewClass, "set_size", webview_set_size, 2);
|
306
315
|
rb_define_method(rb_mCocoaWebviewClass, "get_size", webview_get_size, 0);
|
307
316
|
rb_define_method(rb_mCocoaWebviewClass, "set_pos", webview_set_pos, 2);
|
@@ -363,6 +372,18 @@ VALUE webview_initialize(VALUE self, VALUE debug, VALUE style, VALUE move_title_
|
|
363
372
|
return self;
|
364
373
|
}
|
365
374
|
|
375
|
+
VALUE webview_navigate(VALUE self, VALUE url) {
|
376
|
+
const char *url_c = StringValueCStr(url);
|
377
|
+
NSString *url_ns = [[NSString alloc] initWithCString:url_c encoding:NSUTF8StringEncoding];
|
378
|
+
|
379
|
+
VALUE wrapper = rb_ivar_get(self, rb_intern("@webview"));
|
380
|
+
CocoaWebview *webview;
|
381
|
+
TypedData_Get_Struct(wrapper, CocoaWebview, &cocoawebview_obj_type, webview);
|
382
|
+
|
383
|
+
[webview navigate:url_ns];
|
384
|
+
}
|
385
|
+
|
386
|
+
|
366
387
|
VALUE webview_show(VALUE self) {
|
367
388
|
VALUE wrapper = rb_ivar_get(self, rb_intern("@webview"));
|
368
389
|
CocoaWebview *webview;
|
data/lib/cocoawebview/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoawebview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tommy Jeff
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-10-04 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: Webview ruby binding for macOS
|
13
13
|
email:
|