In my Ionic project, I use a device.ts provider in many custom classes. The problem is, every time I use my custom classes, I have to pass my device provider into it since there's no other way to get to it.
So, my code every time would look like:
let user = User(device);
let cart = Cart(device);
let page = Page(device);
To get around this, in my provider's constructor, I can set
window.device = this;
Now, I don't need to pass device to each of my objects since I can fetch it there as window.device. What's the harm in this? There's nothing simlar to this in Ionic's documentation and I'm not sure why, or if what I'm doing is a bad idea.