happy-dom
Version:
Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. It includes many web standards from WHATWG DOM and HTML.
99 lines • 3.44 kB
JavaScript
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var _History_scrollRestoration;
Object.defineProperty(exports, "__esModule", { value: true });
const HistoryScrollRestorationEnum_js_1 = __importDefault(require("./HistoryScrollRestorationEnum.cjs"));
/**
* History API.
*
* Reference:
* https://developer.mozilla.org/en-US/docs/Web/API/History.
*/
class History {
constructor() {
this.length = 0;
this.state = null;
_History_scrollRestoration.set(this, HistoryScrollRestorationEnum_js_1.default.auto);
}
/**
* Returns scroll restoration.
*
* @returns Sroll restoration.
*/
get scrollRestoration() {
return __classPrivateFieldGet(this, _History_scrollRestoration, "f");
}
/**
* Sets scroll restoration.
*
* @param scrollRestoration Sroll restoration.
*/
set scrollRestoration(scrollRestoration) {
__classPrivateFieldSet(this, _History_scrollRestoration, HistoryScrollRestorationEnum_js_1.default[scrollRestoration]
? scrollRestoration
: __classPrivateFieldGet(this, _History_scrollRestoration, "f"), "f");
}
/**
* Goes to the previous page in session history.
*/
back() {
// Do nothing.
}
/**
* Goes to the next page in session history.
*/
forward() {
// Do nothing.
}
/**
* Load a specific page from the session history.
*
* @param delta Delta.
* @param _delta
*/
go(_delta) {
// Do nothing.
}
/**
* Pushes the given data onto the session history stack.
*
* @param state State.
* @param title Title.
* @param [url] URL.
* @param _state
* @param _title
* @param _url
*/
pushState(_state, _title, _url) {
// Do nothing.
}
/**
* This method modifies the current history entry, replacing it with a new state.
*
* @param state State.
* @param title Title.
* @param [url] URL.
* @param _state
* @param _title
* @param _url
*/
replaceState(_state, _title, _url) {
// Do nothing.
}
}
_History_scrollRestoration = new WeakMap();
exports.default = History;
//# sourceMappingURL=History.cjs.map
;