╭ changed ────────╮ │src/main_wasm.zig│ ╰─────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────╮ │151 try root_ptr.getFocus().setFocus(focus_id); │ │152 } │ │153 │ │154 +fn setFocus(focus_id: usize) !void { │ │155 + const root_ptr = if (root) |*root_value| root_value else return error.NotStarted;│ │156 + try root_ptr.getFocus().setFocus(focus_id); │ │157 +} │ │158 + │ │159 fn consoleLog(arg: []const u8) void { │ │160 _consoleLog(arg.ptr, @intCast(arg.len)); │ │161 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────╮ │222 }; │ │223 } │ │224 │ │225 +export fn _setFocus(focus_id: u32) void { │ │226 + setFocus(focus_id) catch |err| { │ │227 + var buf: [256]u8 = undefined; │ │228 + const str = std.fmt.bufPrint(&buf, "setFocus: {}", .{err}) catch unreachable; │ │229 + consoleLog(str); │ │230 + }; │ │231 +} │ │232 + │ │233 // js calls this when the value of an overlay <input> changes; we replace │ │234 // the matching TextInput's content with the supplied utf-8 bytes. │ │235 export fn _setTextInputValue(focus_id: u32, value_ptr: [*]const u8, value_len: u32) void {│ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯