Fix unbound metrics track function (#10016)

The new metrics controller has a `trackEvent` function that was being
called unbound, so `this` references were undefined. It is now bound
early in both places where it is passed in as a parameter.
feature/default_network_editable
Mark Stacey 4 years ago committed by GitHub
parent 2bcb219501
commit f75c3c6f68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/scripts/metamask-controller.js

@ -287,7 +287,9 @@ export default class MetamaskController extends EventEmitter {
),
provider: this.provider,
blockTracker: this.blockTracker,
trackMetaMetricsEvent: this.metaMetricsController.trackEvent,
trackMetaMetricsEvent: this.metaMetricsController.trackEvent.bind(
this.metaMetricsController,
),
getParticipateInMetrics: () =>
this.metaMetricsController.state.participateInMetaMetrics,
})
@ -1969,7 +1971,9 @@ export default class MetamaskController extends EventEmitter {
engine.push(
createMethodMiddleware({
origin,
sendMetrics: this.metaMetricsController.trackEvent,
sendMetrics: this.metaMetricsController.trackEvent.bind(
this.metaMetricsController,
),
handleWatchAssetRequest: this.preferencesController.requestWatchAsset.bind(
this.preferencesController,
),

Loading…
Cancel
Save