Socket
Socket
Sign inDemoInstall

apify-eventlisteners

Package Overview
Dependencies
202
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    apify-eventlisteners

1. Import these two:


Version published
Maintainers
1
Created

Readme

Source

How to use

  1. Import these two:
import { injectOptions, utilHooks } from 'apify-eventlisteners'
  1. Configure your crawler with them:
const crawler = new Apify.PlaywrightCrawler({
        ...injectOptions,
        requestList,
        preNavigationHooks: [...utilHooks],
        handlePageFunction: async ({ page }) => {
            ...
        },
    });
  1. Use the custom methods:

page.eventListenerList(selector: string)

(selector: string) => Promise<ElementListeners[]>

Returns all found event listeners for all elements matching the specified selector. Ex:

[
    [
        {
            type: 'click'
        },
        {
            type: 'mouseover'
        }
    ],
    [
        {
            type: 'click'
        }
    ]
]

page.removeAllListenersExcept(selectors: string[])

(selectors: string[]) => Promise<void>

Removes event listeners from all elements on the page except for on the ones specified in the array.

Note: Ensure that the event listener has been added to the an prior to trying to remove it with this.

page.removeEventListeners(selector: string)

(selector: string) => Promise<void>

Remove all event listeners from a single element.

Keywords

FAQs

Last updated on 17 Mar 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc