Initial commit with some working code and basic example.

This commit is contained in:
2020-03-21 13:04:54 +05:00
commit 490c5e5cc5
21 changed files with 919 additions and 0 deletions

37
common/const.go Normal file
View File

@@ -0,0 +1,37 @@
package common
const (
HTMLElementA = "a"
HTMLElementBody = "body"
HTMLElementButton = "button"
HTMLElementDiv = "div"
HTMLElementDocument = "document"
HTMLElementHead = "head"
HTMLElementLink = "link"
HTMLElementMeta = "meta"
HTMLElementNav = "nav"
HTMLElementP = "p"
HTMLElementSection = "section"
HTMLElementParameterClassList = "classList"
HTMLElementParameterHref = "href"
HTMLElementParameterID = "id"
HTMLElementParameterRel = "rel"
HTMLElementParameterRole = "role"
HTMLMetaParameterCharset = "charset"
HTMLMetaParameterContent = "content"
HTMLMetaParameterName = "name"
HTMLHeadElementTitle = "title"
JSCallAdd = "add"
JSCallAddEventListener = "addEventListener"
JSCallAppendChild = "appendChild"
JSCallCreateElement = "createElement"
JSCallQuerySelector = "querySelector"
JSConsole = "console"
JSEventDOMContentLoaded = "DOMContentLoaded"
)

10
common/log.go Normal file
View File

@@ -0,0 +1,10 @@
package common
import (
"github.com/gopherjs/gopherjs/js"
)
// Log logs everything passed to Javascript console.
func Log(args ...interface{}) {
js.Global.Get(JSConsole).Call("log", args...)
}