posthog-js
Version:
Posthog-js allows you to automatically capture usage and send events to PostHog.
44 lines • 2.65 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventReceiver = void 0;
var survey_event_receiver_base_1 = require("@posthog/browser-common/survey-event-receiver-base");
var createEventReceiverHost = function (instance) { return ({
get subscribeCapture() {
return (instance === null || instance === void 0 ? void 0 : instance._addCaptureHook)
? function (listener) {
return instance._addCaptureHook(listener);
}
: undefined;
},
subscribeSession: function (listener) { var _a, _b; return (_b = (_a = instance === null || instance === void 0 ? void 0 : instance.onSessionId) === null || _a === void 0 ? void 0 : _a.call(instance, listener)) !== null && _b !== void 0 ? _b : (function () { }); },
getSessionId: function () { var _a; return (_a = instance === null || instance === void 0 ? void 0 : instance.get_session_id) === null || _a === void 0 ? void 0 : _a.call(instance); },
getProperty: function (key) { var _a; return (_a = instance === null || instance === void 0 ? void 0 : instance.persistence) === null || _a === void 0 ? void 0 : _a.props[key]; },
setElementSelectors: function (selectors, owner) { var _a; return (_a = instance === null || instance === void 0 ? void 0 : instance.autocapture) === null || _a === void 0 ? void 0 : _a.setElementSelectors(selectors, owner); },
}); };
var EventReceiver = /** @class */ (function (_super) {
__extends(EventReceiver, _super);
function EventReceiver(instance) {
var _this = _super.call(this, createEventReceiverHost(instance)) || this;
_this._instance = instance;
_this._subscribeSession();
return _this;
}
return EventReceiver;
}(survey_event_receiver_base_1.EventReceiver));
exports.EventReceiver = EventReceiver;
//# sourceMappingURL=event-receiver.js.map