File

src/services/window.service.ts

Description

Service to interact with the window object.

Index

Accessors

Accessors

nativeWindow
getnativeWindow()
import { Injectable } from '@angular/core';

/**
 * Service to interact with the window object.
 */
@Injectable({
  providedIn: 'root',
})
export class WindowService {

  get nativeWindow(): Window {
    return _window();
  }
}

function _window(): Window {
  // Return the global native browser window object
  return typeof window !== 'undefined' ? window : undefined;
}

result-matching ""

    No results matching ""