Commit cbdd6369 authored by h2b's avatar h2b

Termination hint added to documentation.

parent c7128c81
......@@ -84,6 +84,17 @@ to print out all events occurring on the specified `world`.
To get the triggering enabled, the `withEvents` factory methods of `World` or `Screen` have to be used.
Note that the program doesn't terminate by itself on closing all screens if the event package is used. This is due to background processes still listening to the event stream. For explicit termination call the `terminate` method on the package object's `system` value; this can be done, e. g., by subscribing to all screens or worlds and using a termination event like this:
Subscriber.to(world1, world2) {
case KeyEvent(k) if k=='q' ⇒
world1.screen.close()
world2.screen.close()
println("terminating...")
system.terminate()
case _: Event ⇒ ()
}
## API
See [Scaladoc](http://hans-hermann-bode.de/sites/default/files/sites/simgraf/scaladocs/de/h2b/scala/lib/simgraf/index.html).
......
......@@ -35,9 +35,9 @@ import akka.event.EventBus
* So, for example, you just can write
*
* {{{
* Subscriber.to(world) {
* case e: Event ⇒ println(e)
* }
* Subscriber.to(world) {
* case e: Event ⇒ println(e)
* }
* }}}
*
* to print out all events occurring on the specified `world`.
......@@ -45,6 +45,23 @@ import akka.event.EventBus
* To get the triggering enabled, the `withEvents` factory methods of
* `World` or `Screen` have to be used.
*
* Note that the program doesn't terminate by itself on closing all screens if
* the event package is used. This is due to background processes still
* listening to the event stream. For explicit termination call the `terminate`
* method on the package object's `system` value; this can be done, e. g., by
* subscribing to all screens or worlds and using a termination event like this:
*
* {{{
* Subscriber.to(world1, world2) {
* case KeyEvent(k) if k=='q' ⇒
* world1.screen.close()
* world2.screen.close()
* println("terminating...")
* system.terminate()
* case _: Event ⇒ ()
* }
* }}}
*
* @since 1.2.0
* @author h2b
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment