Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GlobalEventsService

whatitdoes

Reponsible for handling and dispatching global events such as window resizing, body scrolling, etc.

consumers

StickyScrollComponent, WatchHeightDirective

providerscope

AppComponent

Hierarchy

  • GlobalEventsService

Index

Constructors

Properties

Methods

Object literals

Constructors

constructor

Properties

emitters$

emitters$: object

Collection of EventEmiiters that broadcast DOM actionable global events.

Type declaration

Private window

window: Window

@Inject is used to allow a mock window during testing (following this Stackoverflow answer).

Methods

onInit

  • onInit(): void

Private requestTick

  • requestTick(type: any): void
  • Called on each event (e.g. scroll/resize)

    • If requestAnimationFrame is currently running, then it will skip this event.
    • When the browser calls requestAnimationFrame the event requested will emit to the subscribers of this event that it is okay to perform short, optimized DOM operations.

    Parameters

    • type: any

    Returns void

Private setupEmitters

  • setupEmitters(): void

Object literals

ticking

ticking: object

True for any event type that is currently waiting for requestAnimationFrame to complete. All animation requests initiated while true will be ignored for the given event type.

resize

resize: boolean = false

scroll

scroll: boolean = false

Generated using TypeDoc