package engine import ( "fmt" "github.com/imkira/go-observer" "sirlab.de/go/knyt/syncdata" "time" ) func NewEngine(id string) *Engine { engine := Engine{ obs: observer.NewProperty(syncdata.SyncData{}), } return &engine } func (engine *Engine) Run() { for { value := engine.obs.Value().(syncdata.SyncData) fmt.Printf("sleep: %d\n", value.VersionRef) time.Sleep(1 * time.Second) value.VersionRef++ engine.obs.Update(value) } } func (engine *Engine) GetHttpHandler() HandleFunc { return SyncFactory(engine.obs) }