From b0643e39808930d2ea5a04f1a35e9b1e14e06861 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Sat, 8 Sep 2018 12:46:03 -0300 Subject: Add documentation to run method. --- docs/client.pod6 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/client.pod6 b/docs/client.pod6 index 6256cde..302e99b 100644 --- a/docs/client.pod6 +++ b/docs/client.pod6 @@ -242,4 +242,34 @@ the servers may choose to implement additional access control for this endpoint. Uploads a file to the server. It returns the MXC URI to the uploaded content. +=head2 run + + method run(Int :$sleep = 10, :$sync-filter? --> Supply) + +Returns a C that emits L with the last +events. The C<$sleep> parameter is to sleep for that amount of seconds before +making a L request again. The C<$sync-filter> is the same parameter that +will be passed to L method to filter out the useful events. + +This can be useful to turn something like: + + my $since; + loop { + $response = $client.sync(:$since); + $since = $response.next-batch; + + for $response.joined-rooms -> $room { + for $room.timeline.event -> $event { + # Do something useful with $event + } + } + } + +into: + + my $sup = $client.run(); + react whenever $sup -> $event { + # Do something useful with $event + } + =end pod -- cgit v1.2.3-54-g00ecf