Adapter-Async

 view release on metacpan or  search on metacpan

lib/Adapter/Async/UnorderedMap.pm  view on Meta::CPAN

Note that "visible" means "the user is able to see this data", so they'd be a single page of data rather than the entire set when no filters are applied. Visibility changes often - scrolling will trigger a visible/hidden pair for example.

Also note that ->get may be called on any element, regardless of visibility - prefetching is one common example here.

=item * hidden - no longer visible.

 hidden => [1,2,4]

=item * selected - this item is now part of an active selection. could be used to block deletes.

 selected => [1,4,5,6]

=item * highlight - mouse over, cursor, etc. 

 highlight => 1

Some views won't raise this - if touch control is involved, for example

=item * activate - some action has been performed.

 activate => [1]
 activate => [1,2,5,6,7,8]

Multi-activate will typically happen when items have been selected rather than just highlighted.

The adapter itself doesn't do much with this.

=back

=cut

=head1 METHODS

=head2 set

Sets the value of a key.

 $adapter->set(xyz => 'abc')

=cut

sub set { ... }

=head2 all

Returns all the items. Shortcut for calling
L</count> then L</get>.

=cut

sub all {
	my ($self, %args) = @_;
	my $f;
	$f = $self->count->then(sub {
		my ($count) = @_;
		return Future->wrap([]) unless $count;
		$self->get(
			%args,
			items => [0..$count-1],
		)
	})->on_ready(sub { undef $f });
	$f
}

1;

__END__

=head1 AUTHOR

Tom Molesworth <TEAM@cpan.org>

=head1 LICENSE

Copyright Tom Molesworth 2013-2015. Licensed under the same terms as Perl itself.



( run in 1.225 second using v1.01-cache-2.11-cpan-d80b1682f3f )