| 1 | ##---------------------------------------------------------------------------- | ||||||||||
| 2 | ## HTML Object - ~/lib/HTML/Object/DOM/WindowProxy.pm | ||||||||||
| 3 | ## Version v0.2.0 | ||||||||||
| 4 | ## Copyright(c) 2021 DEGUEST Pte. Ltd. | ||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||
| 6 | ## Created 2021/12/31 | ||||||||||
| 7 | ## Modified 2022/09/18 | ||||||||||
| 8 | ## All rights reserved | ||||||||||
| 9 | ## | ||||||||||
| 10 | ## | ||||||||||
| 11 | ## This program is free software; you can redistribute it and/or modify it | ||||||||||
| 12 | ## under the same terms as Perl itself. | ||||||||||
| 13 | ##---------------------------------------------------------------------------- | ||||||||||
| 14 | package HTML::Object::DOM::WindowProxy; | ||||||||||
| 15 | BEGIN | ||||||||||
| 16 | { | ||||||||||
| 17 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 1 | ▶ | warnings::register_categories( 'HTML::Object' ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 1 | ▶ | use parent qw( HTML::Object::DOM::Window ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 1 | ▶ | use vars qw( $VERSION ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 1 | ▶ | use HTML::Object::DOM; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 1 | our $VERSION = 'v0.2.0'; | |||||||||
| 24 | }; | ||||||||||
| 25 | |||||||||||
| 26 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | |||||||||||
| 29 | sub AUTOLOAD | ||||||||||
| 30 | { | ||||||||||
| 31 | 0 | ▶ | my( $name ) = our $AUTOLOAD =~ /([^:]+)$/; | ||||||||
|
Subroutine
AUTOLOAD: not called CC=3 SCAR=24.8
| |||||||||||
| 32 | 0 | my $self = shift( @_ ); | |||||||||
| 33 | 0 | my $win = $HTML::Object::DOM::WINDOW; | |||||||||
| 34 | 0 | my $code = $win->can( $name ); | |||||||||
| 35 | 0 | ▶ | die( "No method \"\$name\" in class \"", ref( $win ), "\".\n" ) if( !$code ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | ▶ | eval( "sub $name" . ( Window->is_property( $name ) ? ' : lvalue' : '' ) . " { return( \$HTML::Object::DOM::WINDOW->$name( \@_ ) ); }\n\n" ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 0 | return( $code->( $win, @_ ) ); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 1 | 1; | |||||||||
| 41 | # NOTE: POD | ||||||||||
| 42 | __END__ | ||||||||||
| 43 | |||||||||||
| 44 | =encoding utf-8 | ||||||||||
| 45 | |||||||||||
| 46 | =head1 NAME | ||||||||||
| 47 | |||||||||||
| 48 | HTML::Object::DOM::WindowProxy - HTML Object DOM WindowProxy Class | ||||||||||
| 49 | |||||||||||
| 50 | =head1 SYNOPSIS | ||||||||||
| 51 | |||||||||||
| 52 | use HTML::Object::DOM::WindowProxy; | ||||||||||
| 53 | my $proxy = HTML::Object::DOM::WindowProxy->new || | ||||||||||
| 54 | die( HTML::Object::DOM::WindowProxy->error, "\n" ); | ||||||||||
| 55 | |||||||||||
| 56 | =head1 VERSION | ||||||||||
| 57 | |||||||||||
| 58 | v0.2.0 | ||||||||||
| 59 | |||||||||||
| 60 | =head1 DESCRIPTION | ||||||||||
| 61 | |||||||||||
| 62 | This interface implements a C<WindowProxy>. It is a wrapper around L<HTML::Object::DOM::Window>, but does not inherit from it. | ||||||||||
| 63 | |||||||||||
| 64 | This does not do any specific otherwise, other than existing. | ||||||||||
| 65 | |||||||||||
| 66 | Under JavaScript, a C<WindowProxy> object is a wrapper for a L<Window|HTML::Object::DOM::Window> object. A C<WindowProxy> object exists in every browsing context. All operations performed on a C<WindowProxy> object will also be applied to the underlying L<Window|HTML::Object::DOM::Window> object it currently wraps. Therefore, interacting with a WindowProxy object is almost identical to directly interacting with a Window object. When a browsing context is navigated, the Window object its WindowProxy wraps is changed. | ||||||||||
| 67 | |||||||||||
| 68 | =head1 INHERITANCE | ||||||||||
| 69 | |||||||||||
| 70 | +-----------------------+ +---------------------------+ +---------------------------+ | ||||||||||
| 71 | | HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Window | | ||||||||||
| 72 | +-----------------------+ +---------------------------+ +---------------------------+ | ||||||||||
| 73 | |||||||||||
| 74 | =head1 PROPERTIES | ||||||||||
| 75 | |||||||||||
| 76 | All properties are redirecting to those in L<HTML::Object::DOM::Window> | ||||||||||
| 77 | |||||||||||
| 78 | =head1 METHODS | ||||||||||
| 79 | |||||||||||
| 80 | All methods are redirecting to those in L<HTML::Object::DOM::Window> | ||||||||||
| 81 | |||||||||||
| 82 | =head1 EVENTS & EVENT LISTENERS | ||||||||||
| 83 | |||||||||||
| 84 | All events and event listeners are redirecting to those in L<HTML::Object::DOM::Window> | ||||||||||
| 85 | |||||||||||
| 86 | =head1 AUTHOR | ||||||||||
| 87 | |||||||||||
| 88 | Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> | ||||||||||
| 89 | |||||||||||
| 90 | =head1 SEE ALSO | ||||||||||
| 91 | |||||||||||
| 92 | L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Glossary/WindowProxy>, L<StackOverlow about WindowProxy|https://stackoverflow.com/questions/16092835/windowproxy-and-window-objects> | ||||||||||
| 93 | |||||||||||
| 94 | =head1 COPYRIGHT & LICENSE | ||||||||||
| 95 | |||||||||||
| 96 | Copyright(c) 2021 DEGUEST Pte. Ltd. | ||||||||||
| 97 | |||||||||||
| 98 | All rights reserved | ||||||||||
| 99 | |||||||||||
| 100 | This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | ||||||||||
| 101 | |||||||||||
| 102 | =cut | ||||||||||