~eliasnaur/gio

cmd/gio: add <div id="giowindow"> in <body> v1 SUPERSEDED

> Running gio in my browser would not work till I did this.
> 
> Also fix the note about the div in the README by wrapping backticks
> around it.
> 
> Signed-off-by: Larry Clapp <larry@theclapp.org>
> ---
> README.md          | 2 +-
> cmd/gio/jsbuild.go | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/README.md b/README.md
> index f2c4f34..e529d2c 100644
> --- a/README.md
> +++ b/README.md
> @@ -113,7 +113,7 @@ Building for tvOS requires (the not yet released) Go 1.13.
> ## Webassembly/WebGL
> 
> To run a Gio program in a browser with WebAssembly and WebGL support, use the Go webassembly
> -driver and add a <div id="giowindow"> element to a HTML page. The gio tool can also output
> +driver and add a `<div id="giowindow">` element to a HTML page. The gio tool can also output
> a directory ready to view in a browser:
> 
> $ go run gioui.org/cmd/gio -target js gioui.org/apps/gophers
> diff --git a/cmd/gio/jsbuild.go b/cmd/gio/jsbuild.go
> index 5f84745..7b48f95 100644
> --- a/cmd/gio/jsbuild.go
> +++ b/cmd/gio/jsbuild.go
> @@ -59,6 +59,7 @@ func buildJS(bi *buildInfo) error {
> </style>
> </head>
> <body>
> +           <div id="giowindow"></div>
Commit eee497f22a3d738e954a83052bcd24c3bdfd6c17 removed this line and
added support
to gioui.org/ui/app to auto-create it if missing. I just pushed a
commit that updates the gio version
for gioui.org/apps. Webassembly programs should now run without this
line. If not, make sure
you've cleared caches.
> Commit eee497f22a3d738e954a83052bcd24c3bdfd6c17 removed this line and
> added support
> to gioui.org/ui/app to auto-create it if missing. I just pushed a
> commit that updates the gio version
> for gioui.org/apps. Webassembly programs should now run without this
> line. If not, make sure
> you've cleared caches.
I don't know what I'm doing wrong, but I can't get this to work.  If I
add the div by hand to index.html then it works.  (I have cleared
caches.)

Did you at least merge the change to the README?

-- Larry
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~eliasnaur/gio/%3C20190802210848.45638-1-larry%40theclapp.org%3E/mbox | git am -3
Learn more about email & git

[PATCH] cmd/gio: add <div id="giowindow"> in <body> Export this patch

Running gio in my browser would not work till I did this.

Also fix the note about the div in the README by wrapping backticks
around it.

Signed-off-by: Larry Clapp <larry@theclapp.org>
---
 README.md          | 2 +-
 cmd/gio/jsbuild.go | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index f2c4f34..e529d2c 100644
--- a/README.md
+++ b/README.md
@@ -113,7 +113,7 @@ Building for tvOS requires (the not yet released) Go 1.13.
 ## Webassembly/WebGL
 
 To run a Gio program in a browser with WebAssembly and WebGL support, use the Go webassembly
-driver and add a <div id="giowindow"> element to a HTML page. The gio tool can also output
+driver and add a `<div id="giowindow">` element to a HTML page. The gio tool can also output
 a directory ready to view in a browser:
 
 	$ go run gioui.org/cmd/gio -target js gioui.org/apps/gophers
diff --git a/cmd/gio/jsbuild.go b/cmd/gio/jsbuild.go
index 5f84745..7b48f95 100644
--- a/cmd/gio/jsbuild.go
+++ b/cmd/gio/jsbuild.go
@@ -59,6 +59,7 @@ func buildJS(bi *buildInfo) error {
 		</style>
 	</head>
 	<body>
+	    <div id="giowindow"></div>
 	</body>
 </html>`
 	if err := ioutil.WriteFile(filepath.Join(out, "index.html"), []byte(indexhtml), 0600); err != nil {
-- 
2.22.0
> Running gio in my browser would not work till I did this.
> 
> Also fix the note about the div in the README by wrapping backticks
> around it.
> 
> Signed-off-by: Larry Clapp <larry@theclapp.org>
> ---
> README.md          | 2 +-
> cmd/gio/jsbuild.go | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/README.md b/README.md
> index f2c4f34..e529d2c 100644
> --- a/README.md
> +++ b/README.md
> @@ -113,7 +113,7 @@ Building for tvOS requires (the not yet released) Go 1.13.
> ## Webassembly/WebGL
> 
> To run a Gio program in a browser with WebAssembly and WebGL support, use the Go webassembly
> -driver and add a <div id="giowindow"> element to a HTML page. The gio tool can also output
> +driver and add a `<div id="giowindow">` element to a HTML page. The gio tool can also output
> a directory ready to view in a browser:
> 
> $ go run gioui.org/cmd/gio -target js gioui.org/apps/gophers
> diff --git a/cmd/gio/jsbuild.go b/cmd/gio/jsbuild.go
> index 5f84745..7b48f95 100644
> --- a/cmd/gio/jsbuild.go
> +++ b/cmd/gio/jsbuild.go
> @@ -59,6 +59,7 @@ func buildJS(bi *buildInfo) error {
> </style>
> </head>
> <body>
> +           <div id="giowindow"></div>
Commit eee497f22a3d738e954a83052bcd24c3bdfd6c17 removed this line and
added support
to gioui.org/ui/app to auto-create it if missing. I just pushed a
commit that updates the gio version
for gioui.org/apps. Webassembly programs should now run without this
line. If not, make sure
you've cleared caches.
View this thread in the archives