| 1 | package MoobX::Scalar::Observable; | ||||||||||
| 2 | 7 | our $AUTHORITY = 'cpan:YANICK'; | |||||||||
| 3 | # ABSTRACT: Observable role for MobX scalars | ||||||||||
| 4 | 7 | $MoobX::Scalar::Observable::VERSION = '0.1.2'; | |||||||||
| 5 | |||||||||||
| 6 | 7 | ▶ | use 5.20.0; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 7 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 7 | ▶ | use Scalar::Util 'refaddr'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 26 | ▶ | before 'FETCH' => sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||
| 13 | 26 | my $self = shift; | |||||||||
| 14 | 26 | ▶ | push @MoobX::DEPENDENCIES, $self if $MoobX::WATCHING; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 7 | }; | |||||||||
| 16 | |||||||||||
| 17 | 27 | ▶ | after 'STORE' => sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||
| 18 | 27 | my $self = shift; | |||||||||
| 19 | |||||||||||
| 20 | 27 | ▶ | MoobX::observable_ref($self->value) if ref $self->value; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 27 | MoobX::observable_modified( $self ); | |||||||||
| 22 | 7 | }; | |||||||||
| 23 | |||||||||||
| 24 | 7 | 1; | |||||||||
| 25 | |||||||||||
| 26 | __END__ | ||||||||||