ember-metrics
Advanced tools
Comparing version 1.5.1 to 2.0.0-beta.1
@@ -15,4 +15,3 @@ import BaseAdapter from 'ember-metrics/metrics-adapters/base'; | ||
// eslint-disable-next-line ember/classic-decorator-hooks | ||
init() { | ||
install() { | ||
const { config } = this; | ||
@@ -113,7 +112,5 @@ const { apiKey, options } = config; | ||
willDestroy() { | ||
uninstall() { | ||
removeFromDOM('script[src*="amplitude"]'); | ||
delete window.amplitude; | ||
} | ||
} |
@@ -10,4 +10,3 @@ import { assert } from '@ember/debug'; | ||
// eslint-disable-next-line ember/classic-decorator-hooks | ||
init() { | ||
install() { | ||
assert( | ||
@@ -55,3 +54,3 @@ `[ember-metrics] You must pass a \`instrumentationKey\`to the ${this.toString()} adapter`, | ||
willDestroy() { | ||
uninstall() { | ||
removeFromDOM('script[src*="azure"]'); | ||
@@ -58,0 +57,0 @@ |
@@ -1,6 +0,4 @@ | ||
import emberObject from '@ember/object'; | ||
import { assert, deprecate } from '@ember/debug'; | ||
import { assert } from '@ember/debug'; | ||
import { guidFor } from '@ember/object/internals'; | ||
import { typeOf } from '@ember/utils'; | ||
import { setOwner } from '@ember/application'; | ||
@@ -11,57 +9,24 @@ function makeToString(ret) { | ||
export default class BaseAdapter extends emberObject { | ||
export default class BaseAdapter { | ||
static supportsFastBoot = false; | ||
metrics = null; | ||
config = null; | ||
constructor(config, owner) { | ||
super(...arguments); | ||
setOwner(this, owner); | ||
constructor(config) { | ||
this.config = config; | ||
this.init(); | ||
} | ||
// eslint-disable-next-line ember/classic-decorator-hooks | ||
init() { | ||
assert(`[ember-metrics] ${this.toString()} must implement the init hook!`); | ||
} | ||
willDestroy() { | ||
install() { | ||
assert( | ||
`[ember-metrics] ${this.toString()} must implement the willDestroy hook!` | ||
`[ember-metrics] ${this.toString()} must implement the install hook!` | ||
); | ||
} | ||
get() { | ||
deprecate( | ||
'Metrics Adapters must not use EmberObject methods as they will be implemented as native classes in the next major release', | ||
false, | ||
{ | ||
id: 'ember-metrics-issue-287', | ||
for: 'ember-metrics', | ||
url: 'https://github.com/adopted-ember-addons/ember-metrics/issues/287', | ||
since: '1.4.0', | ||
until: '2.0.0', | ||
} | ||
uninstall() { | ||
assert( | ||
`[ember-metrics] ${this.toString()} must implement the uninstall hook!` | ||
); | ||
super.get(...arguments); | ||
} | ||
set() { | ||
deprecate( | ||
'Metrics Adapters must not use EmberObject methods as they will be implemented as native classes in the next major release', | ||
false, | ||
{ | ||
id: 'ember-metrics.issue-287', | ||
for: 'ember-metrics', | ||
url: 'https://github.com/adopted-ember-addons/ember-metrics/issues/287', | ||
since: '1.4.0', | ||
until: '2.0.0', | ||
} | ||
); | ||
super.set(...arguments); | ||
} | ||
toString() { | ||
@@ -68,0 +33,0 @@ const hasToStringExtension = typeOf(this.toStringExtension) === 'function'; |
@@ -11,4 +11,3 @@ import { compact } from 'ember-metrics/-private/utils/object-transforms'; | ||
// eslint-disable-next-line ember/classic-decorator-hooks | ||
init() { | ||
install() { | ||
const { id, dataProcessingOptions } = this.config; | ||
@@ -70,3 +69,3 @@ | ||
willDestroy() { | ||
uninstall() { | ||
if (window.fbq) { | ||
@@ -73,0 +72,0 @@ removeFromDOM('script[src*="fbevents.js"]'); |
@@ -15,4 +15,3 @@ import { isPresent } from '@ember/utils'; | ||
// eslint-disable-next-line ember/classic-decorator-hooks | ||
init() { | ||
install() { | ||
const config = { ...this.config }; | ||
@@ -120,3 +119,3 @@ const { id, sendHitTask, trace, require, debug, trackerName } = config; | ||
willDestroy() { | ||
uninstall() { | ||
removeFromDOM('script[src*="google-analytics"]'); | ||
@@ -123,0 +122,0 @@ |
@@ -14,4 +14,3 @@ import { assert } from '@ember/debug'; | ||
// eslint-disable-next-line ember/classic-decorator-hooks | ||
init() { | ||
install() { | ||
const { id, dataLayer, envParams } = this.config; | ||
@@ -78,3 +77,3 @@ const envParamsString = envParams ? `&${envParams}` : ''; | ||
willDestroy() { | ||
uninstall() { | ||
removeFromDOM('script[src*="gtm.js"]'); | ||
@@ -81,0 +80,0 @@ |
@@ -16,4 +16,3 @@ import { assert } from '@ember/debug'; | ||
// eslint-disable-next-line ember/classic-decorator-hooks | ||
init() { | ||
install() { | ||
const { appId } = this.config; | ||
@@ -75,3 +74,3 @@ | ||
willDestroy() { | ||
uninstall() { | ||
removeFromDOM('script[src*="intercom"]'); | ||
@@ -78,0 +77,0 @@ |
@@ -10,4 +10,3 @@ import { assert } from '@ember/debug'; | ||
// eslint-disable-next-line ember/classic-decorator-hooks | ||
init() { | ||
install() { | ||
const { matomoUrl, containerId } = this.config; | ||
@@ -14,0 +13,0 @@ |
@@ -15,4 +15,3 @@ import { assert } from '@ember/debug'; | ||
// eslint-disable-next-line ember/classic-decorator-hooks | ||
init() { | ||
install() { | ||
const config = { ...{ batch_requests: true }, ...this.config }; | ||
@@ -84,3 +83,3 @@ const { token } = config; | ||
willDestroy() { | ||
uninstall() { | ||
removeFromDOM('script[src*="mixpanel"]'); | ||
@@ -87,0 +86,0 @@ |
@@ -15,4 +15,3 @@ import BaseAdapter from './base'; | ||
// eslint-disable-next-line ember/classic-decorator-hooks | ||
init() { | ||
install() { | ||
const { apiKey } = this.config; | ||
@@ -67,3 +66,3 @@ | ||
willDestroy() { | ||
uninstall() { | ||
removeFromDOM('script[src*="pendo.js"]'); | ||
@@ -70,0 +69,0 @@ |
@@ -10,4 +10,3 @@ import { assert } from '@ember/debug'; | ||
// eslint-disable-next-line ember/classic-decorator-hooks | ||
init() { | ||
install() { | ||
const { piwikUrl, siteId } = this.config; | ||
@@ -53,3 +52,3 @@ | ||
willDestroy() { | ||
uninstall() { | ||
removeFromDOM('script[src*="piwik"]'); | ||
@@ -56,0 +55,0 @@ |
@@ -11,4 +11,3 @@ import { assert } from '@ember/debug'; | ||
// eslint-disable-next-line ember/classic-decorator-hooks | ||
init() { | ||
install() { | ||
const config = { ...this.config }; | ||
@@ -147,3 +146,3 @@ const segmentKey = config.key; | ||
willDestroy() { | ||
uninstall() { | ||
removeFromDOM('script[src*="segment.com"]'); | ||
@@ -150,0 +149,0 @@ |
@@ -156,9 +156,5 @@ import Service from '@ember/service'; | ||
_activateAdapter({ adapterClass, config }) { | ||
const decoratedClass = class extends adapterClass { | ||
identify = this.identify; | ||
alias = this.alias; | ||
trackEvent = this.trackEvent; | ||
trackPage = this.trackPage; | ||
}; | ||
return new decoratedClass(config, getOwner(this)); | ||
const adapter = new adapterClass(config); | ||
adapter.install(); | ||
return adapter; | ||
} | ||
@@ -215,6 +211,6 @@ | ||
* @method willDestroy | ||
* @return {Void} | ||
* @return {void} | ||
*/ | ||
willDestroy() { | ||
Object.values(this._adapters).forEach((adapter) => adapter.destroy()); | ||
Object.values(this._adapters).forEach((adapter) => adapter.uninstall()); | ||
} | ||
@@ -221,0 +217,0 @@ } |
# v1.1.0 | ||
## v1.5.1 (2022-05-12) | ||
## v2.0.0-beta.1 (2022-05-12) | ||
### Changes | ||
- Revert a broad refactor to native classes that's not backwards compatible https://github.com/adopted-ember-addons/ember-metrics/pull/372 | ||
A significant the Metrics adapter API. We're rewriting these as native classes | ||
in order to move away from the Ember Object model. Historically we've relied | ||
upon the `init` and `willDestroy` hooks to do our cleanup. Moving forward an | ||
`install` and `uninstall` hook will need to be defined. Please see the | ||
[Google Analytics](https://github.com/adopted-ember-addons/ember-metrics/blob/4d0f088a302597d3ab7b2e5efd08ce51a78b1d68/addon/metrics-adapters/google-analytics.js) | ||
for an example. | ||
@@ -9,0 +14,0 @@ |
{ | ||
"name": "ember-metrics", | ||
"version": "1.5.1", | ||
"version": "2.0.0-beta.1", | ||
"description": "Send data to multiple analytics integrations without re-implementing new API", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
45
77370
1263
1