Skip to content

HTTPS clone URL

Subversion checkout URL

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