Initial commit
This commit is contained in:
commit
4972944cc0
11 changed files with 748 additions and 0 deletions
14
src/main.zig
Normal file
14
src/main.zig
Normal file
|
@ -0,0 +1,14 @@
|
|||
//! WebUI Zig - Minimal Example
|
||||
const webui = @import("webui");
|
||||
const std = @import("std");
|
||||
|
||||
pub fn main() !void {
|
||||
// create a new window
|
||||
var nwin = webui.newWindow();
|
||||
|
||||
// show the content
|
||||
try nwin.show("<html><head><script src=\"/webui.js\"></script></head> Hello World ! </html>");
|
||||
|
||||
// wait the window exit
|
||||
webui.wait();
|
||||
}
|
24
src/root.zig
Normal file
24
src/root.zig
Normal file
|
@ -0,0 +1,24 @@
|
|||
//! By convention, root.zig is the root source file when making a library.
|
||||
const std = @import("std");
|
||||
|
||||
pub fn bufferedPrint() !void {
|
||||
// Stdout is for the actual output of your application, for example if you
|
||||
// are implementing gzip, then only the compressed bytes should be sent to
|
||||
// stdout, not any debugging messages.
|
||||
const stdout_file = std.fs.File.stdout().deprecatedWriter();
|
||||
// Buffering can improve performance significantly in print-heavy programs.
|
||||
var bw = std.io.bufferedWriter(stdout_file);
|
||||
const stdout = bw.writer();
|
||||
|
||||
try stdout.print("Run `zig build test` to run the tests.\n", .{});
|
||||
|
||||
try bw.flush(); // Don't forget to flush!
|
||||
}
|
||||
|
||||
pub fn add(a: i32, b: i32) i32 {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
test "basic add functionality" {
|
||||
try std.testing.expect(add(3, 7) == 10);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue