Skip to content

Commit

Permalink
Merge pull request sourcegraph#27 from hopkings2008/master
Browse files Browse the repository at this point in the history
add Load function into webloop
  • Loading branch information
sqs authored Mar 6, 2018
2 parents 9aa4fcc + cb957db commit 72049fd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions webloop.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ func (v *View) Open(url string) {
})
}

func (v *View) Load(content, baseUrl string) {
v.load = make(chan struct{}, 1)
v.lastLoadErr = nil
glib.IdleAdd(func() bool {
if !v.destroyed {
v.WebView.LoadHTML(content, baseUrl)
}
return false
})
}

// Wait waits for the current page to finish loading.
func (v *View) Wait() error {
<-v.load
Expand Down

0 comments on commit 72049fd

Please sign in to comment.