Socket
Book a DemoInstallSign in
Socket

apify-event-listeners

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

apify-event-listeners

1. Import these two:

1.0.2
unpublished
latest
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

How to use

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

page.eventListenerList(selector: string)

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

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.

page.removeWindowClickListeners()

() => Promise<void>

Remove all click listeners from the window object

page.blockAdsWithZIndexMethod(maxZIndex: number)

(maxZIndex: string) => Promise<void>

Block any elements with a z-index that exceeds what you specify

page.removeFishyElements()

() => Promise<void>

Set an interval on the page that runs every second to automatically remove any fishy elements

Keywords

apify

FAQs

Package last updated on 18 Mar 2022

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.