/
githubmirror
/
atom
Обзор
Документация
Войти
/
githubmirror
/
atom
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
packages/welcome/lib/reporter-proxy.js
27 строк
591 B
Jason Rudolph
:shirt:
12 авг 2019, 15:42
Не верифицирован
12 авг 2019, 15:42
35449e8
Код
Авторство
О чём код?
/** @babel */ export default class ReporterProxy { constructor() { this.reporter = null; this.queue = []; this.eventType = 'welcome-v1'; } setReporter(reporter) { this.reporter = reporter; let customEvent; while ((customEvent = this.queue.shift())) { this.reporter.addCustomEvent(this.eventType, customEvent); } } sendEvent(action, label, value) { const event = { ea: action, el: label, ev: value }; if (this.reporter) { this.reporter.addCustomEvent(this.eventType, event); } else { this.queue.push(event); } } }