Skip to content

v0.6.0

Compare
Choose a tag to compare
@ttytm ttytm released this 09 Oct 11:49
· 48 commits to main since this release

The release makes the module safer and more convenient to use and extends test coverage.

What's Changed

Generated release notes:

  • feat!: add get_arg[T] to parse JS args of any type by @ttytm in #29
  • refactor: cleanup icon, return error code, fix incompatible hwnd ptr type warning by @ttytm in #26
  • feat: add bind_opt and bind_opt_with_ctx by @ttytm in #30

Full Changelog: v0.5.0...v0.6.0


New get_arg event method

Moves towards using get_arg[T](idx int) !T to parse JS args to V data types. It's a more uniform approach that embraces error handling and is made the libs default. E.g.:

// Use
e.get_arg[string](0) or { ... }

// Instead of
e.string(0)
e.string_opt(0) or { ... } 

Marks methods like e.string() as deprecated.

New bind_opt and bind_opt_with_ctx webview methods

Allows to return errors to JS. E.g.:

w.bind_opt('v_fn_with_custom_error', fn (e &webview.Event) !int {
	// ...
	return error('my error')
})
w.bind_opt('v_fn_with_error_propagation', fn (e &webview.Event) !string {
	return os.existing_path('my_inexistent_path/file.v')!
})
try {
	await window.v_fn_with_error_propagation();
} catch (err) {
	console.log(err); // -> path does not exist
}