| 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 | use strict; | ||
| 18 | use warnings; | ||
| 19 | warnings::register_categories( 'HTML::Object' ); | ||
| 20 | use parent qw( HTML::Object::DOM::Window ); | ||
| 21 | use vars qw( $VERSION ); | ||
| 22 | use HTML::Object::DOM; | ||
| 23 | our $VERSION = 'v0.2.0'; | ||
| 24 | }; | ||
| 25 | |||
| 26 | use strict; | ||
| 27 | use warnings; | ||
| 28 | |||
| 29 | sub AUTOLOAD | ||
| 30 | { | ||
| 31 | my( $name ) = our $AUTOLOAD =~ /([^:]+)$/; | ||
| 32 | my $self = shift( @_ ); | ||
| 33 | my $win = $HTML::Object::DOM::WINDOW; | ||
| 34 | my $code = $win->can( $name ); | ||
| 35 | die( "No method \"\$name\" in class \"", ref( $win ), "\".\n" ) if( !$code ); | ||
| 36 | eval( "sub $name" . ( Window->is_property( $name ) ? ' : lvalue' : '' ) . " { return( \$HTML::Object::DOM::WINDOW->$name( \@_ ) ); }\n\n" ); | ||
| 37 | return( $code->( $win, @_ ) ); | ||
| 38 | } | ||
| 39 | |||
| 40 | 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 |