… | |
… | |
1136 | |
1136 | |
1137 | my $cb = $arg{cb}; |
1137 | my $cb = $arg{cb}; |
1138 | |
1138 | |
1139 | urxvt::timer |
1139 | urxvt::timer |
1140 | ->new |
1140 | ->new |
1141 | ->after ($arg{after}) |
1141 | ->after ($arg{after}, $arg{interval}) |
1142 | ->interval ($arg{interval}) |
|
|
1143 | ->start |
|
|
1144 | ->cb ($argv{interval} ? $cb : sub { |
1142 | ->cb ($arg{interval} ? $cb : sub { |
1145 | $_[0]->stop; # need to cancel manually |
1143 | $_[0]->stop; # need to cancel manually |
1146 | $cb->(); |
1144 | $cb->(); |
1147 | }) |
1145 | }) |
1148 | } |
1146 | } |
1149 | |
1147 | |
… | |
… | |
2055 | |
2053 | |
2056 | =item $timer = $timer->cb (sub { my ($timer) = @_; ... }) |
2054 | =item $timer = $timer->cb (sub { my ($timer) = @_; ... }) |
2057 | |
2055 | |
2058 | Set the callback to be called when the timer triggers. |
2056 | Set the callback to be called when the timer triggers. |
2059 | |
2057 | |
2060 | =item $tstamp = $timer->at |
|
|
2061 | |
|
|
2062 | Return the time this watcher will fire next. |
|
|
2063 | |
|
|
2064 | =item $timer = $timer->set ($tstamp) |
2058 | =item $timer = $timer->set ($tstamp[, $interval]) |
2065 | |
2059 | |
2066 | Set the time the event is generated to $tstamp. |
2060 | Set the time the event is generated to $tstamp (and optionally specifies a |
|
|
2061 | new $interval). |
2067 | |
2062 | |
2068 | =item $timer = $timer->interval ($interval) |
2063 | =item $timer = $timer->interval ($interval) |
2069 | |
2064 | |
2070 | Normally (and when C<$interval> is C<0>), the timer will automatically |
2065 | By default (and when C<$interval> is C<0>), the timer will automatically |
2071 | stop after it has fired once. If C<$interval> is non-zero, then the timer |
2066 | stop after it has fired once. If C<$interval> is non-zero, then the timer |
2072 | is automatically rescheduled at the given intervals. |
2067 | is automatically rescheduled at the given intervals. |
2073 | |
2068 | |
2074 | =item $timer = $timer->start |
2069 | =item $timer = $timer->start |
2075 | |
2070 | |
2076 | Start the timer. |
2071 | Start the timer. |
2077 | |
2072 | |
2078 | =item $timer = $timer->start ($tstamp) |
2073 | =item $timer = $timer->start ($tstamp[, $interval]) |
2079 | |
2074 | |
2080 | Set the event trigger time to C<$tstamp> and start the timer. |
2075 | Set the event trigger time to C<$tstamp> and start the timer. Optionally |
|
|
2076 | also replaces the interval. |
2081 | |
2077 | |
2082 | =item $timer = $timer->after ($delay) |
2078 | =item $timer = $timer->after ($delay[, $interval]) |
2083 | |
2079 | |
2084 | Like C<start>, but sets the expiry timer to c<urxvt::NOW + $delay>. |
2080 | Like C<start>, but sets the expiry timer to c<urxvt::NOW + $delay>. |
2085 | |
2081 | |
2086 | =item $timer = $timer->stop |
2082 | =item $timer = $timer->stop |
2087 | |
2083 | |