Browse Source

Add dom.Loop helper struct

master
Brett Langdon 7 years ago
parent
commit
354270b448
No known key found for this signature in database GPG Key ID: B664881177781B04
2 changed files with 34 additions and 0 deletions
  1. +17
    -0
      generate/static/loop.go
  2. +17
    -0
      loop.go

+ 17
- 0
generate/static/loop.go View File

@ -0,0 +1,17 @@
package dom
type Loop struct {
stop chan bool
}
func NewLoop() *Loop {
return &Loop{
stop: make(chan bool),
}
}
func (l *Loop) Stop() { l.stop <- true }
func (l *Loop) Loop() {
<-l.stop
}

+ 17
- 0
loop.go View File

@ -0,0 +1,17 @@
package dom
type Loop struct {
stop chan bool
}
func NewLoop() *Loop {
return &Loop{
stop: make(chan bool),
}
}
func (l *Loop) Stop() { l.stop <- true }
func (l *Loop) Loop() {
<-l.stop
}

Loading…
Cancel
Save