mirror of
https://github.com/taigrr/wasm-experiments
synced 2025-01-18 04:03:21 -08:00
Remove gRPC example, add some simpler examples
This commit is contained in:
17
div/div.go
Normal file
17
div/div.go
Normal file
@@ -0,0 +1,17 @@
|
||||
// +build js,wasm
|
||||
|
||||
package div
|
||||
|
||||
import "github.com/dennwc/dom"
|
||||
|
||||
// Writer implements an io.Writer that appends content
|
||||
// to the dom.Element. It should ideally be used on a <div> element.
|
||||
type Writer dom.Element
|
||||
|
||||
// Write implements io.Writer.
|
||||
func (d Writer) Write(p []byte) (n int, err error) {
|
||||
node := dom.GetDocument().CreateElement("div")
|
||||
node.SetInnerHTML(string(p))
|
||||
(*dom.Element)(&d).AppendChild(node)
|
||||
return len(p), nil
|
||||
}
|
||||
Reference in New Issue
Block a user