-
-
Save crazy2be/7404422 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
observ := observable.NewObservable(g, 0) | |
observ.OnChanged(g, func(new observable.Object, old observable.Object) { | |
if new.(int) < 1 { | |
return | |
} | |
fmt.Println("First set", new, "(", old,") call gets", observ.Get()); | |
}) | |
observ.OnChanged(g, func(new observable.Object, old observable.Object) { | |
if new.(int) < 1 { | |
return | |
} | |
fmt.Println("Second set", new, "(", old,") call gets", observ.Get()); | |
if new.(int) < 10 { | |
observ.Set(new.(int) + 1) | |
} | |
}) | |
observ.OnChanged(g, func(new observable.Object, old observable.Object) { | |
if new.(int) < 1 { | |
return | |
} | |
fmt.Println("Third set", new, "(", old,") call gets", observ.Get()); | |
}) | |
observ.Set(1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment