UNPKG

@atlaskit/editor-plugin-interactivity

Version:

Interactivity plugin for @atlaskit/editor-core

31 lines (29 loc) • 1.2 kB
import { ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums'; /** * The `editor interactivity` operational event. * * `editorSessionId` arrives without being set here: `@atlaskit/analytics-listeners` merges * the editor analytics context into the attributes of every event on the editor channel. * `objectId` comes both from that context and from the snapshot, which carries the value * the session was collected against. */ /** * Sends a snapshot's attributes as the `editor interactivity` event. * * Does nothing without the analytics plugin: an editor without it has nowhere to send events, * and the collector keeps measuring either way. */ export function fireInteractivityEvent(analytics, attributes, _ref) { var immediate = _ref.immediate; analytics === null || analytics === void 0 || analytics.fireAnalyticsEvent({ action: 'interactivity', actionSubject: ACTION_SUBJECT.EDITOR, eventType: EVENT_TYPE.OPERATIONAL, attributes: attributes }, undefined, // Events are queued into an idle callback by default, which a page being unloaded never // runs and a backgrounded tab throttles. { immediate: immediate }); }