Bug fix: Add gopherjs:blocking for the latest GopherJS

This commit is contained in:
Hajime Hoshi 2015-02-09 11:16:23 +09:00
parent 249add3979
commit fdedee9aab
2 changed files with 20 additions and 17 deletions

View File

@ -28,6 +28,7 @@ const bufferSize = 1024
func audioProcess(channel int) func(e js.Object) { func audioProcess(channel int) func(e js.Object) {
return func(e js.Object) { return func(e js.Object) {
go func() {
defer func() { defer func() {
currentPosition += bufferSize currentPosition += bufferSize
}() }()
@ -46,6 +47,7 @@ func audioProcess(channel int) func(e js.Object) {
l.SetIndex(i, float64(inputL[i])/max) l.SetIndex(i, float64(inputL[i])/max)
r.SetIndex(i, float64(inputR[i])/max) r.SetIndex(i, float64(inputR[i])/max)
} }
}()
} }
} }

3
run.go
View File

@ -79,7 +79,8 @@ func Run(f func(*Image) error, width, height, scale int, title string) error {
if err := graphicsContext.preUpdate(); err != nil { if err := graphicsContext.preUpdate(); err != nil {
return err return err
} }
if err := f(graphicsContext.screen); err != nil { err := f(graphicsContext.screen) //gopherjs:blocking
if err != nil {
return err return err
} }
if err := graphicsContext.postUpdate(); err != nil { if err := graphicsContext.postUpdate(); err != nil {