BranchMetrics / cordova-ionic-phonegap-branch-deep-linking-attribution

The Branch Cordova Ionic Phonegap SDK for deep linking and attribution. Branch helps mobile apps grow with deep links / deeplinks that power paid acquisition and re-engagement campaigns, referral programs, content sharing, deep linked emails, smart banners, custom user onboarding, and more.
https://docs.branch.io/apps/cordova-phonegap-ionic/
MIT License
234 stars 144 forks source link

Why referencing a window object `Branch = window['Branch']` and not injecting through dependency injection? #696

Open michalsisak opened 2 years ago

michalsisak commented 2 years ago

Hello, I wonder why you mention in your docs a way how to inject Branch through window object: const Branch = window['Branch'];

and not the regular way by initializing it in constructor like:

export class UserService {
  constructor(
    private branch: BranchIo,
 ) {}

Is there any difference or drawback between those two methods?

Stack involved: Angular, Ionic 3, Capacitor ( I know there is a capacitor version of this plugin where the branch is only imported)