24 lines
423 B
JavaScript
24 lines
423 B
JavaScript
class Metrika {
|
|
constructor(counterCb) {
|
|
this.cb = counterCb;
|
|
}
|
|
|
|
get counter() {
|
|
return this.cb.call();
|
|
}
|
|
|
|
hit(name) {
|
|
if (this.counter) {
|
|
this.counter.hit(name);
|
|
}
|
|
}
|
|
|
|
goal(name, params = {}) {
|
|
if (this.counter) {
|
|
this.counter.reachGoal(name, params);
|
|
}
|
|
}
|
|
}
|
|
|
|
export default new Metrika(() => window.yaCounter41913764);
|