Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 31 lines (23 sloc) 0.454 kB
f4f25e8 @rcaputo Hide some of the promise awkwardness in a Promise watcher.
authored
1 package ReflexPromise;
5b0127b @rcaputo Remove emit() from roles.
authored
2 # vim: ts=2 sw=2 noexpandtab
f4f25e8 @rcaputo Hide some of the promise awkwardness in a Promise watcher.
authored
3
4 use Moose;
1f5ed27 @rcaputo Rename Reflex::Role::Object to Reflex::Role::Reactive; Reflex::Object…
authored
5 extends 'Reflex::Base';
f4f25e8 @rcaputo Hide some of the promise awkwardness in a Promise watcher.
authored
6
7 use Reflex::Callbacks qw(cb_promise);
8
9 has object => (
1f5ed27 @rcaputo Rename Reflex::Role::Object to Reflex::Role::Reactive; Reflex::Object…
authored
10 isa => 'Reflex::Base',
f4f25e8 @rcaputo Hide some of the promise awkwardness in a Promise watcher.
authored
11 is => 'ro',
12 );
13
14 has promise => (
15 isa => 'ScalarRef',
16 is => 'ro',
17 default => sub { return \my $x },
18 );
19
20 sub BUILD {
21 my $self = shift;
5f9458c @rcaputo Rename observe() to watch(). Rename wait() to next().
authored
22 $self->watch($self->object(), cb_promise($self->promise()));
f4f25e8 @rcaputo Hide some of the promise awkwardness in a Promise watcher.
authored
23 }
24
5f9458c @rcaputo Rename observe() to watch(). Rename wait() to next().
authored
25 sub next {
f4f25e8 @rcaputo Hide some of the promise awkwardness in a Promise watcher.
authored
26 my $self = shift;
5f9458c @rcaputo Rename observe() to watch(). Rename wait() to next().
authored
27 return ${$self->promise()}->next();
f4f25e8 @rcaputo Hide some of the promise awkwardness in a Promise watcher.
authored
28 }
29
30 1;
Something went wrong with that request. Please try again.