Skip to content

Releases: ttytm/webview

v0.7.0

18 Nov 12:33
Compare
Choose a tag to compare

What's Changed

The goal of this release is to add quality of life features for developers.

For applications that build their user interface using a node web framework, serve_dev and serve_satic have been integrated.

  • serve_dev - for usage during development
    serve_dev('ui_path') // Runs `npm run dev` in the `ui_path` and connects the webview window to it.
    serve_dev('ui_path', pkg_manager: .pnpm, script: 'start') // Runs `pnpm start` in the `ui_path` and "
  • serve_static - for usage in the compiled application
    serve_static('ui_path') // Uses vweb to serve a UI that has been built into a static site and "

Adds a minimal example using Astro: https://github.com/ttytm/webview/tree/main/examples/astro-project

Full Changelog: v0.6.0...v0.7.0

v0.6.0

09 Oct 11:49
Compare
Choose a tag to compare

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
}

v0.5.0

15 Sep 14:18
Compare
Choose a tag to compare

What's Changed

  • Async by default and native return types for more convenience and improved type safety (#25)

    // Comparison, sketching version differences and problems solved.
    
    // v0.4.0
    fn my_v_fn_called_from_js(e &Event) {
    	spawn fn (e &Event) {
    		interim_res := my_fn_with_err_potential() or { return } // Handled error, but missed returning a value to JS.
    		// ...  further time extensive processing.
    		e.@return(res)
    	}(e.async()) // Use `async()` to return a JS result form another thread.
    }
    
    // v0.5.0
    fn my_v_fn_called_from_js(e &Event) string {
    	interim_res := my_fn_with_err_potential() or { return '' } // Correct return type required.
    	// ...  further time extensive processing.
    	return res
    }
  • Add set_icon() method to set the icon for a window (for now it supports Windows and Linux) (#24)

New Contributors

Full Changelog: v0.4.0...v0.5.0

v0.4.0

29 Aug 18:23
Compare
Choose a tag to compare

Introduces a new API for V an JS interoperability

Example:

// v0.3
fn my_v_func(event_id &char, raw_args &char, mut app App) {
  hello_from_js_arg := json.decode([]string, unsafe { raw_args.vstring() }) or { return }[0]
  app.w.result(event_id, .value, json.encode(hello_from_js_arg + ' Hello back from V!'))
}

// v0.4
fn my_v_func(e &webview.Event) {
  hello_from_js_arg := e.string(0)
  e.@return(hello_from_js_arg + ' Hello back from V!')
}

The goal of this release is to extend the libraries capabilities and make it simpler to use.
Examples are updated and simplified as well as the documentation is updated to reflect the usage.

v0.3.0

15 Aug 18:29
Compare
Choose a tag to compare

What's Changed

  • feat: add windows support, extend build script (#12)

Full Changelog: v0.2.1...v0.3.0

v0.2.1

11 Aug 18:48
Compare
Choose a tag to compare

What's Changed

  • fix: building on macOS with Intel CPUs (#5)