… | |
… | |
209 | use Scalar::Util (); |
209 | use Scalar::Util (); |
210 | |
210 | |
211 | use AnyEvent (); |
211 | use AnyEvent (); |
212 | use AnyEvent::Util (); |
212 | use AnyEvent::Util (); |
213 | |
213 | |
214 | our $VERSION = '0.1'; |
214 | our $VERSION = '0.2'; |
215 | |
215 | |
216 | sub OBSID() { 0x10000000000000 } # 2**52 |
216 | sub OBSID() { 0x10000000000000 } # 2**52 |
217 | |
217 | |
218 | our $JSON = eval { require JSON::XS; JSON::XS:: } |
218 | our $JSON = eval { require JSON::XS; JSON::XS:: } |
219 | || do { require JSON::PP; JSON::PP:: }; |
219 | || do { require JSON::PP; JSON::PP:: }; |
… | |
… | |
691 | When called in void context, the observer stays in place until F<mpv> |
691 | When called in void context, the observer stays in place until F<mpv> |
692 | is stopped. In any otrher context, these methods return a guard |
692 | is stopped. In any otrher context, these methods return a guard |
693 | object that, when it goes out of scope, unregisters the observe using |
693 | object that, when it goes out of scope, unregisters the observe using |
694 | C<unobserve_property>. |
694 | C<unobserve_property>. |
695 | |
695 | |
|
|
696 | Internally, this method uses observer ids of 2**52 (0x10000000000000) or |
|
|
697 | higher - it will not interfere with lower ovserver ids, so it is possible |
|
|
698 | to completely ignore this system and execute C<observe_property> commands |
|
|
699 | yourself, whilst listening to C<property-change> events - as long as your |
|
|
700 | ids stay below 2**52. |
|
|
701 | |
696 | Example: register observers for changtes in C<aid> and C<sid>. Note that |
702 | Example: register observers for changtes in C<aid> and C<sid>. Note that |
697 | a dummy statement is added to make sure the method is called in void |
703 | a dummy statement is added to make sure the method is called in void |
698 | context. |
704 | context. |
699 | |
705 | |
700 | sub register_observers { |
706 | sub register_observers { |