From 6f4eff548f3c5faa785be4205da8d505077f19e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Garc=C3=ADa?= Date: Tue, 1 Nov 2011 22:45:05 +0100 Subject: [PATCH] added halting event observation section on README --- README.textile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.textile b/README.textile index 7350eac..03d4cd7 100644 --- a/README.textile +++ b/README.textile @@ -72,6 +72,16 @@ This library allows you to build "walls" between them: your keyboard code will j You can obviously attach any number of observers to any given event. Similarly, you are +h1. Halting event observation + +Every call to @beholder:observe@ returns an identifier which can be stored: + +
local id = beholder:observe("FOO", bar, baz)
+ +That identifier can be used to cancel the observation at any moment. You can do so by using the @beholder:stopObserving@ method: + +
beholder:stopObserving(id)
+ h1. Composed events Events can be any type of Lua object. On the example, we used the "PAUSE" string. It could also be a number, a function or a table. The == operator is used in all cases.