-1

I know that you can trigger events with window:onmousedown or document:onmousedown, but I want to trigger an event when the user clicks anywhere on the screen, even outside of the app. For instance, if I'm running the app in a web browser, I want to trigger an event when the user clicks the edges of the browser to resize it. Any ideas?

georgeawg
  • 48,608
  • 13
  • 72
  • 95
gkeenley
  • 6,088
  • 8
  • 54
  • 129

1 Answers1

1

You are asking two different things here. The second, window resizing, has solutions.There are several answers on SO that relate to resizing windows:

how i can detect window resize instantly in angular 2?

Angular window resize event

And an NPM package that can detect resizing:

angular-resize-event

But these all work when the window is resized as an event, not just clicking on the edge of the browser window so that may not work for you, depending on what exactly it is you want to do.

If you wanted to know if a user clicked completely outside the browser window e.g. on the desktop somewhere that isn't possible as far as I know.

Steve
  • 1,903
  • 5
  • 22
  • 30