Skip to content

Commit

Permalink
fix: cstring encoding and mac support (#103)
Browse files Browse the repository at this point in the history
Co-authored-by: Elias Sjögreen <[email protected]>
  • Loading branch information
hoangpq and eliassjogreen committed Feb 17, 2022
1 parent d19defc commit ea2aad1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/webview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import sys from "./ffi.ts";
const encoder = new TextEncoder();

function encode(value: string) {
return encoder.encode(value + "\n");
return encoder.encode(value + "\0");
}

export type SizeHint = 0 | 1 | 2 | 3;
Expand All @@ -28,11 +28,12 @@ export class Webview {
return this.#url;
}

constructor() {
constructor(width: number = 1024, height: number = 768, hint: SizeHint = 0) {
this.#handle = sys.symbols.deno_webview_create(
0,
null,
) as Deno.UnsafePointer;
sys.symbols.deno_webview_set_size(this.#handle, width, height, hint);
}

terminate() {
Expand Down

0 comments on commit ea2aad1

Please sign in to comment.