sphinx_pyppeteer_builder/typings/pyppeteer/worker.pyi

52 lines
1.6 KiB
Python

"""
This type stub file was generated by pyright.
"""
from typing import Any, Callable, Dict, List, TYPE_CHECKING
from pyee import EventEmitter
from pyppeteer.execution_context import ExecutionContext, JSHandle
from pyppeteer.connection import CDPSession
"""Worker module."""
if TYPE_CHECKING:
...
logger = ...
class Worker(EventEmitter):
"""The Worker class represents a WebWorker.
The events `workercreated` and `workerdestroyed` are emitted on the page
object to signal the worker lifecycle.
.. code::
page.on('workercreated', lambda worker: print('Worker created:', worker.url))
"""
def __init__(self, client: CDPSession, url: str, consoleAPICalled: Callable[[str, List[JSHandle]], None], exceptionThrown: Callable[[Dict], None]) -> None:
...
@property
def url(self) -> str:
"""Return URL."""
...
async def executionContext(self) -> ExecutionContext:
"""Return ExecutionContext."""
...
async def evaluate(self, pageFunction: str, *args: Any) -> Any:
"""Evaluate ``pageFunction`` with ``args``.
Shortcut for ``(await worker.executionContext).evaluate(pageFunction, *args)``.
"""
...
async def evaluateHandle(self, pageFunction: str, *args: Any) -> JSHandle:
"""Evaluate ``pageFunction`` with ``args`` and return :class:`~pyppeteer.execution_context.JSHandle`.
Shortcut for ``(await worker.executionContext).evaluateHandle(pageFunction, *args)``.
"""
...