@atlaskit/editor-plugin-interactivity
Version:
Interactivity plugin for @atlaskit/editor-core
36 lines (34 loc) • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.fireInteractivityEvent = fireInteractivityEvent;
var _enums = require("@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.
*/
function fireInteractivityEvent(analytics, attributes, _ref) {
var immediate = _ref.immediate;
analytics === null || analytics === void 0 || analytics.fireAnalyticsEvent({
action: 'interactivity',
actionSubject: _enums.ACTION_SUBJECT.EDITOR,
eventType: _enums.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
});
}