Skip to content

Commit

Permalink
update deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Oct 8, 2023
1 parent 008ae45 commit 15111bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/project-structure/src/api.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fn (mut app App) bind(w &Webview) {
// The first string argument is the functions name in the JS frontend.
// Use JS's `camelCase` convention or distinct identifiers if you prefer it.
w.bind('get_settings', app.get_settings)
w.bind_ctx('toggle_setting', toggle, app) // Alternatively use the ctx ptr to pass a struct.
w.bind_with_ctx('toggle_setting', toggle, app) // Alternatively use the ctx ptr to pass a struct.
w.bind('login', login)
w.bind('fetch_news', fetch_news)
}
Expand All @@ -17,7 +17,7 @@ fn (app App) get_settings(_ &Event) Settings {
}

// Returns a value when it's called from JS.
// This examples uses bind_ctx, adding the App struct as context argument.
// This examples uses `bind_with_ctx` to add the App struct as context argument.
fn toggle(_ &Event, mut app App) bool {
app.settings.toggle = !app.settings.toggle
dump(app.settings.toggle)
Expand Down
4 changes: 2 additions & 2 deletions examples/v-js-interop-app/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn (app App) get_settings(_ &Event) Settings {
}

// Returns a value when it's called from JS.
// This examples uses bind_ctx, adding the App struct as context argument.
// This examples uses `bind_with_ctx` to add the App struct as context argument.
fn toggle(_ &Event, mut app App) bool {
app.settings.toggle = !app.settings.toggle
dump(app.settings.toggle)
Expand Down Expand Up @@ -78,7 +78,7 @@ fn main() {
// The first string argument is the functions name in the JS frontend.
// Use JS's `camelCase` convention or distinct identifiers if you prefer it.
w.bind('get_settings', app.get_settings)
w.bind_ctx('toggle_setting', toggle, &app) // Alternatively use the ctx ptr to pass a struct.
w.bind_with_ctx('toggle_setting', toggle, &app) // Alternatively use the ctx ptr to pass a struct.
w.bind('login', login)
w.bind('fetch_news', fetch_news)

Expand Down

0 comments on commit 15111bb

Please sign in to comment.