asaskevich/EventBus — pull request #1 by bennAH (2014-12-21 01:06:08+00:00)
Title: added publish async

func slowCalculator(a, b int) {
time.Sleep(3 * time.Second)
fmt.Printf("%d\n", a + b)
}

bus.Subscribe("main:slow_calculator", slowCalculator);
wait := bus.PublishAsync("main:slow_calculator", 30, 70);
fmt.Println("waiting for result")

// uncomment next 3 lines for awkward pause
fmt.Println("start: do some stuff while waiting for a result")
time.Sleep(2 * time.Second)
mt.Println("end: do some stuff while waiting for a result")

wait.Wait();