respond-framework
Version:
create as fast you think
20 lines (19 loc) • 777 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _getSessionState = require("../helpers/getSessionState.js");
var _constants = require("../../helpers/constants.js");
var _default = exports.default = _constants.isTest ? function () {} : function () {
if (this.branches.replayTools?.playing) return;
if (this.topState !== window.state) return; // ensure replayEvents saves new state instead of old state when recreating state for replays
if (!this.rememberSession) return;
if (timeout) clearTimeout(timeout);
timeout = setTimeout(() => {
timeout = null;
const snap = this.snapshot(this.topState);
(0, _getSessionState.setSessionState)(snap, this.ctx.lastTriggerEvent);
}, 1000);
};
let timeout;