Skip to content

chore: generate events docs #897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions playwright/_impl/_async_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import asyncio
import traceback
from types import TracebackType
from typing import Any, Awaitable, Callable, Generic, Type, TypeVar, Union
from typing import Any, Awaitable, Callable, Generic, Type, TypeVar

from playwright._impl._impl_to_api_mapping import ImplToApiMapping, ImplWrapper

Expand Down Expand Up @@ -73,19 +73,17 @@ def _wrap_handler(self, handler: Any) -> Callable[..., None]:
return mapping.wrap_handler(handler)
return handler

def on(self, event: str, f: Callable[..., Union[Awaitable[None], None]]) -> None:
def on(self, event: Any, f: Any) -> None:
"""Registers the function ``f`` to the event name ``event``."""
self._impl_obj.on(event, self._wrap_handler(f))

def once(self, event: str, f: Callable[..., Union[Awaitable[None], None]]) -> None:
def once(self, event: Any, f: Any) -> None:
"""The same as ``self.on``, except that the listener is automatically
removed after being called.
"""
self._impl_obj.once(event, self._wrap_handler(f))

def remove_listener(
self, event: str, f: Callable[..., Union[Awaitable[None], None]]
) -> None:
def remove_listener(self, event: Any, f: Any) -> None:
"""Removes the function ``f`` from ``event``."""
self._impl_obj.remove_listener(event, self._wrap_handler(f))

Expand Down
6 changes: 3 additions & 3 deletions playwright/_impl/_sync_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,17 @@ def _wrap_handler(self, handler: Any) -> Callable[..., None]:
return mapping.wrap_handler(handler)
return handler

def on(self, event: str, f: Callable[..., None]) -> None:
def on(self, event: Any, f: Any) -> None:
"""Registers the function ``f`` to the event name ``event``."""
self._impl_obj.on(event, self._wrap_handler(f))

def once(self, event: str, f: Callable[..., None]) -> None:
def once(self, event: Any, f: Any) -> None:
"""The same as ``self.on``, except that the listener is automatically
removed after being called.
"""
self._impl_obj.once(event, self._wrap_handler(f))

def remove_listener(self, event: str, f: Callable[..., None]) -> None:
def remove_listener(self, event: Any, f: Any) -> None:
"""Removes the function ``f`` from ``event``."""
self._impl_obj.remove_listener(event, self._wrap_handler(f))

Expand Down
Loading