Reference Source
import Helper from 'squidwarc/lib/crawler/helper.js'
public class | source

Helper

A helper class providing utility methods

Static Method Summary

Static Public Methods
public static

addEventListener(emitter: EventEmitter, eventName: string, handler: function()): function()

Register an eventName, eventListener pairs on an EventEmitter

public static

addEventListeners(emitter: EventEmitter, events: function()): function()

Register an array of eventName, eventListener pairs to an EventEmitter

public static

Remove the listeners registered on an EventEmitter by either addEventListener or addEventListeners

Static Public Methods

public static addEventListener(emitter: EventEmitter, eventName: string, handler: function()): function() source

Register an eventName, eventListener pairs on an EventEmitter

Params:

NameTypeAttributeDescription
emitter EventEmitter
  • nullable: false

The EventEmitter to register the eventName, eventListener pairs on

eventName string

The name of the event to register the handler (listener) on

handler function()

The event listener to be registered for the event

Return:

function()

public static addEventListeners(emitter: EventEmitter, events: function()): function() source

Register an array of eventName, eventListener pairs to an EventEmitter

Params:

NameTypeAttributeDescription
emitter EventEmitter
  • nullable: false

The EventEmitter to register the eventName, eventListener pairs on

events function()

The array of eventName, eventListener pairs

Return:

function()

public static removeEventListeners(listeners: function()) source

Remove the listeners registered on an EventEmitter by either addEventListener or addEventListeners

Params:

NameTypeAttributeDescription
listeners function()
  • nullable: false