Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions dom.go
Original file line number Diff line number Diff line change
Expand Up @@ -1043,8 +1043,7 @@ func (w *window) Top() Window {
}

func (w *window) History() History {
// FIXME implement
return nil
return &history{w.Get("history")}
}

func (w *window) Navigator() Navigator {
Expand Down Expand Up @@ -2851,3 +2850,35 @@ func (css *CSSStyleDeclaration) Length() int {
type Text struct {
*BasicNode
}

type history struct {
*js.Object
}

func (h *history) Length() int {
return h.Get("length").Int()
}

func (h *history) State() interface{} {
return h.Get("state")
}

func (h *history) Back() {
h.Call("back")
}

func (h *history) Forward() {
h.Call("forward")
}

func (h *history) Go(offset int) {
h.Call("go", offset)
}

func (h *history) PushState(state interface{}, title string, url string) {
h.Call("pushState", state, title, url)
}

func (h *history) ReplaceState(state interface{}, title string, url string) {
h.Call("replaceState", state, title, url)
}